我有一个页面 需要保存成word格式 由于里面的表格比较复杂 我采用了下面的方法
Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename=FileName.doc");
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
Response.ContentType = "application/ms-word";//设置输出文件类型为word文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
但是有个问题 页面里面的图片不能保存到word里 请大家帮忙看看还有什么更好的办法
Response.Clear();
Response.Buffer= true;
Response.Charset="GB2312";
Response.AppendHeader("Content-Disposition","attachment;filename=FileName.doc");
Response.ContentEncoding=System.Text.Encoding.GetEncoding("GB2312");//设置输出流为简体中文
Response.ContentType = "application/ms-word";//设置输出文件类型为word文件。
this.EnableViewState = false;
System.Globalization.CultureInfo myCItrad = new System.Globalization.CultureInfo("ZH-CN",true);
System.IO.StringWriter oStringWriter = new System.IO.StringWriter(myCItrad);
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
但是有个问题 页面里面的图片不能保存到word里 请大家帮忙看看还有什么更好的办法
解决方案 »
- org.in2bits.MyXls读取EXCEL文件报错 new XlsDocument 创建对象报错
- 高手指教:Silverlight 如何获得页面里的dataset(datatable)?
- datalist显示图片的问题
- 老话重谈,关于面向对象和面向过程的理解
- datagrid大数字量显示问题
- 我按书上的实例做asp.net的web水晶报表报以下错误,请问我该怎么办?
- 未注册ISAM是什么意思?
- SQL语句怎么做求和?
- 怎么实现GridView控件向sql数据库表格插入int型字段(string型已成功插入)
- vs2010 添加用户自定义控件卡屏
- 关闭页面,不需要系统提示,应该怎么做?
- 新手求问:一个页面里,在3个DataGrid控件中使用DataReader对象同时显示的问题!
然后再word里面用宏命令插入即可
你上网上搜索一下