在.NET环境下将报表导出Excel和Word
http://dotnet.aspx.cc/ShowDetail.aspx?id=6AFBF00B-459D-4642-AD14-8A4765FFAFCC
http://dotnet.aspx.cc/ShowDetail.aspx?id=6AFBF00B-459D-4642-AD14-8A4765FFAFCC
解决方案 »
- EXCEL的問題:為什麼EXCEL裡數字後面帶Q和R的數據都不能導入到SQL 2005數據庫?
- TreeNode怎么添加子节点?
- 大家帮我看看我这个 循环是不是有“内伤”阿???
- 求 VS 2005 开发asp.net的视频教程,有不?
- 关于数据传输的问题
- 新手问题:如何统计某一页面的点击次数?
- 非常着急!程序没问题给朋友那过去就不能用!求解决方法!
- 另开贴寻求帮助:使用(javascipt)windows.open打开新窗口的问题-----------急
- 关于在MultiPage控件里的DataGrid的事件!
- 帮忙看看平台互操作的问题。感激不尽!
- 如何在关闭框架网页中的子网页时清除它的session?
- 我这样更改域用户的密码怎么不可以?
http://community.csdn.net/Expert/topic/3217/3217552.xml?temp=.4888422
Word.ApplicationClass word = new Word.ApplicationClass();
Word.DocumentClass doc = new Word.DocumentClass();
Type type = doc.GetType();
doc = word.Documents.Add(null,null,type,false); //这是我调用的方法
上句中提示的Add函数是(ref object Template, ref object NewTemplate, ref object DocumnetType, ref object Visible);
但这样的函数怎么调用啊!
还有
Word.Table table;
table = doc.Tables.Add(doc.Range0,0), dt.Rows.Count + 1, dt.Columns.Count + 1,null,null); //这是我调用的方法
上句中的Add函数是(Word.Range Range, int NumRows, int NumColumns, ref object DefaultTableBehavior, ref object AutoFitBehavior);
这两个函数调用都有问题,郁闷中,请大虾们帮小弟看看.....
{HttpContext.Current.Response.Charset ="";
HttpContext.Current.Response.AppendHeader("Content-Disposition","attachment;filename=money.xls");
HttpContext.Current.Response.ContentEncoding =System.Text.Encoding.GetEncoding("GB2312");
HttpContext.Current.Response.ContentType ="application/ms-excel";//application/msword
System.IO.StringWriter tw = new System.IO.StringWriter() ;
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
ctl.RenderControl(hw);
HttpContext.Current.Response.Write(tw);
}
这是DATAGRID导向XSL,要导向WORD只要改文件名类型就可以了,上面有备注,别外DATATABLE也是一样的道理