谁能给我excelwriter? 我可以给你他是将数据库的数据写道excel的免费工具明天上www.ourfly.com去下载 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 I want to know who have buy the excelwriter and how about its funtion and the payment term. 我给你个函数,但你要自己稍微修改一下。请加入com组件microsoft excel 5.0库。// 倒入: public static string WriteDataGrid2Excel(DataSet dt,ArrayList tableHead,string pathAndFileName) { try { SpreadsheetClass xlsheet = new SpreadsheetClass(); int i; for (int j=0;j<5;j++) { xlsheet.ActiveSheet.Cells[1,j+1]=tableHead[j]; } for(i=0;i<dt.Tables[0].Rows.Count;i++) { DataRow rw = dt.Tables[0].Rows[i]; for (int j=0;j<rw.ItemArray.Length;j++) { string temp=rw[j].ToString(); if(temp==" ") xlsheet.ActiveSheet.Cells[i+2,j+1] = ""; else xlsheet.ActiveSheet.Cells[i+2,j+1] =temp; } } xlsheet.ActiveSheet.Export(pathAndFileName+".xls",OWC.SheetExportActionEnum.ssExportActionNone); return "true"; } catch(Exception ee) { return ee.Message.ToString(); } } 请教,在内存生成zip文件流问题 jquery ajax有时候得不到数据 Repeater生成HTML有空行 ASP.NET 2.0 UpdatePanel 弹出窗口的问题 一个SQL语句,害我想了半天没成功,麻烦下高手 asp网站中添加asp.net网站遇到的问题 发布一个网站地址(有大量电子书下载,绝对真实!) reportviewer的部署问题 textbox追加显示数据后如何实现滚动到最后一行? webform中,怎样在不继承Page的类中应用Session... 怎么捕获文本框中的双击事件?
请加入com组件microsoft excel 5.0库。
// 倒入:
public static string WriteDataGrid2Excel(DataSet dt,ArrayList tableHead,string pathAndFileName)
{
try
{
SpreadsheetClass xlsheet = new SpreadsheetClass();
int i;
for (int j=0;j<5;j++)
{
xlsheet.ActiveSheet.Cells[1,j+1]=tableHead[j];
}
for(i=0;i<dt.Tables[0].Rows.Count;i++)
{
DataRow rw = dt.Tables[0].Rows[i];
for (int j=0;j<rw.ItemArray.Length;j++)
{
string temp=rw[j].ToString();
if(temp==" ")
xlsheet.ActiveSheet.Cells[i+2,j+1] = "";
else xlsheet.ActiveSheet.Cells[i+2,j+1] =temp; }
}
xlsheet.ActiveSheet.Export(pathAndFileName+".xls",OWC.SheetExportActionEnum.ssExportActionNone);
return "true";
}
catch(Exception ee)
{
return ee.Message.ToString();
}
}