try:
http://www.csdn.net/Develop/read_article.asp?id=15544
http://www.csdn.net/Develop/read_article.asp?id=15544
解决方案 »
- 界面为什么会卡
- 【寻求帮助】问:生成的密码列表文件放在系统盘什么地方好!!!
- 关于winfrom show 出WPF窗体的~
- C#新手报到...向大家问好!
- 如何刷新框架中的左边框呢?
- 用sqlhelper如何返回一个reader 和一个输出参数
- 按习惯如何反编译别人的程序.
- C# WinForm求指教下面这段循环处理网页代码如何改进?
- 自定义控件,改变自定义控件大小,里面的跟的控件跟着变
- ArrayList的使用...
- Excel.Workbook.SaveAs(filename,...)或Excel.Worksheet.SaveAs(filename,...)函数,当filename文件已经存在,如何覆盖保存?
- 为什么WEB窗体的button控件在浏览器里面显示不出来,而HTML控件里的button就可以
int rowIndex=1;
int colIndex=0; excel.Application.Workbooks.Add(true);
DataTable table=GetData();
//将所得到的表的列名,赋值给单元格
foreach(DataColumn col in table.Columns)
{
colIndex++;
excel.Cells[1,colIndex]=col.ColumnName;
} //同样方法处理数据
foreach(DataRow row in table.Rows)
{
rowIndex++;
colIndex=0;
foreach(DataColumn col in table.Columns)
{
colIndex++;
excel.Cells[rowIndex,colIndex]=row[col.ColumnName].ToString();
}
}
//不可见,即后台处理
excel.Visible=true;