当前位置: 代码迷 >> ASP.NET >> asp.net 导出(上载)Excel xp、win7 兼容
  详细解决方案

asp.net 导出(上载)Excel xp、win7 兼容

热度:3570   发布时间:2013-02-25 00:00:00.0
asp.net 导出(下载)Excel xp、win7 兼容
服务器上 .net 2008 / excel 2003
C# code
            respObj.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");            respObj.AppendHeader("Content-Disposition", "attachment;filename=" + strFileName);            string strColHeaders = "", strLstItem = "";            int i = 0;            DataSet dstObj = GetDataSet(strSQL, strTableName);            DataTable dtblObj = dstObj.Tables[0];            DataRow[] drowObj = dtblObj.Select("");            // strTypeID=="1"            if (strTypeID == "1")            {                for (i = 0; i <= dtblObj.Columns.Count - 2; i++)                {                    strColHeaders += dtblObj.Columns[i].Caption.ToString() + "\t";                }                strColHeaders += dtblObj.Columns[i].Caption.ToString() + "\n";                respObj.Write(strColHeaders);                foreach (DataRow drowObjTmp in drowObj)                {                    for (i = 0; i <= dtblObj.Columns.Count - 2; i++)                    {                        strLstItem += drowObjTmp[i].ToString() + "\t";                    }                    strLstItem += drowObjTmp[i].ToString() + "\n";                    respObj.Write(strLstItem);                    strLstItem = "";                }            }

问题 win7 导出的Excel 打不开 有什么办法?
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Tue Jul 17 23:06:36 CST 2018
  • 最近登录:Tue Jul 17 23:06:36 CST 2018
  • 最近登录:Tue Jul 17 23:06:36 CST 2018
  • 最近登录:Tue Jul 17 23:06:36 CST 2018
  • 最近登录:Tue Jul 17 23:06:36 CST 2018