输出当前页面到word
要求:输出时将页面上的控件用本身的值替换
如: <div style="width: 100%; height: 380px; overflow: auto">
<p align="center">
<b>关于 <input type='text' style='width: 100px; border: none; border-bottom: solid 1px'>党(总)支部增补委员的请示 </b> </p>
<p>
<select width=90> <option>公司党委 </option> <option>机关党总支 </option> </select>:
</p>
<p>
鉴于 <select width=90> <option>工作需要 </option> <option>本届委员会任期届满 </option> </select>
,进行增补委员的时机已经成熟,根据《中国共产党章程》的有关规定和 <select width=90> <option>公司党委文件精神 </option> <option>机关党总支意见 </option> </select>,决定增补——————等——同志为党(总)支部委员: </p>
<p align="left">
简历介绍如下: </p>
</div> 将input控件和select控件替换掉。。只显示他们的输入值或选择项的text文本
要求:输出时将页面上的控件用本身的值替换
如: <div style="width: 100%; height: 380px; overflow: auto">
<p align="center">
<b>关于 <input type='text' style='width: 100px; border: none; border-bottom: solid 1px'>党(总)支部增补委员的请示 </b> </p>
<p>
<select width=90> <option>公司党委 </option> <option>机关党总支 </option> </select>:
</p>
<p>
鉴于 <select width=90> <option>工作需要 </option> <option>本届委员会任期届满 </option> </select>
,进行增补委员的时机已经成熟,根据《中国共产党章程》的有关规定和 <select width=90> <option>公司党委文件精神 </option> <option>机关党总支意见 </option> </select>,决定增补——————等——同志为党(总)支部委员: </p>
<p align="left">
简历介绍如下: </p>
</div> 将input控件和select控件替换掉。。只显示他们的输入值或选择项的text文本
解决方案 »
- 文件上传,本地测试成功,网上发布后出现 System.NullReferenceException: 未将对象引用设置到对象的实例。
- 关于创建文件夹后,给某些文件夹设置权限。求高手。有代码。
- asp实现插入数据,编号自动加1
- 过节兼问问题!正则高手进!
- 在服务器上,上传图片,有的可以传,有的出错
- 想做个网站玩玩。。没想好名字。。请大家帮想想
- 如何处理字符串中的特殊字符?
- 程序集“Lodb.SQLServerDAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null”中的类型“Lodb.SQLServerDAL.ProductsDAL”的方法“GetKey
- 请问:上传文件所使用的HtmlInputBox能不能上传大于4M的文件??怎么做??
- 一个软件项目经理的遭遇,见信,一切真实!大家来声讨流氓老板吧!!!!
- DetailsView的几个简单问题!!!!1
- 求js的网址的正则表达式
my.Close();
StreamWriter myw = new StreamWriter(Server.MapPath("myw.doc"));
myw.Write(name);
myw.Close();LZ要自己解决编码的问题。
word我已经导出来了
要保证格式不变
Response.Buffer= true;
Response.Charset="utf-8"; Response.AppendHeader("Content- Disposition","attachment;filename=1.doc");
Response.ContentEncoding=System.Text.Encoding.GetEncoding("utf-8");
Response.ContentType = "application/ms-word";
this.EnableViewState = false; System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
通过正则替换相关元素
html = Regex.Replace(html, "<[^>]+>", "");
可以替换掉html标签
wuyq11 :
Response.Clear();
Response.Buffer= true;
Response.Charset="utf-8"; Response.AppendHeader("Content- Disposition","attachment;filename=1.doc");
Response.ContentEncoding=System.Text.Encoding.GetEncoding("utf-8");
Response.ContentType = "application/ms-word";
this.EnableViewState = false; System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
this.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();
通过正则替换相关元素我也是这种方式输出的。但是有个问题。正则如何替换。。能不能重写Control输出事件实现替换。。能做到吗?