惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
MyScale Blog
MyScale Blog
博客园_首页
G
Google Developers Blog
博客园 - 【当耐特】
美团技术团队
博客园 - 聂微东
Stack Overflow Blog
Stack Overflow Blog
Vercel News
Vercel News
小众软件
小众软件
博客园 - 司徒正美
雷峰网
雷峰网
T
Tailwind CSS Blog
V
V2EX
博客园 - 三生石上(FineUI控件)
F
Fortinet All Blogs
罗磊的独立博客
量子位
P
Proofpoint News Feed
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog

博客园 - №阿儒№

Inetinfo 进程 100%的解决方法 useless setTimeout call (missing quotes around argument?)解决方案 "invalid header field"解决方案 解决因为安装Lingoes 2.4后剪贴板无法正常工作的问题 FreeMarker学习 Extjs分页时遇上ivalid label的解决原理 UTF8与UTF8 without BOM之间的问题 - №阿儒№ [错误解决列表]解决异常信息 收集中 解决WEB页的中英文显示问题 [bug]Upload Excel File时碰到的问题 [bug]解决因系统问题无法连接MQ reporting service学习-- 配置文件 [bug]访问ASP.NET临时文件夹的权限问题 如何解决FTP上传文件时出现的"Access is denied"错误? - №阿儒№ SQL Server 2005 Reporting Services 初次使用感受 [bug]Server Application Unavailable VS 中最简单的部署方式XCOPY Link Server的语法 [Bug]:创建虚拟目录出现别名已经存在的解决方案
将HTML中的内容存入WORD
№阿儒№ · 2005-09-01 · via 博客园 - №阿儒№

                DateTime dtime = DateTime.Now;
                
string FileName = dtime.Year.ToString() + "-" + dtime.Month.ToString() + "-" + dtime.Day.ToString() 
                    
+ "~" + dtime.Hour.ToString() + "-" + dtime.Minute.ToString() + "-" + dtime.Second.ToString() + "-" + dtime.Millisecond.ToString() + ".doc";
                
string Path = Server.MapPath("../PhoneSN_doc/" + FileName);

                StreamWriter sr 
= File.CreateText(Path);
                StringWriter tw 
= new StringWriter();
                HtmlTextWriter hw
=new HtmlTextWriter(tw);
                
//tb0.RenderControl(hw);
                tb1.RenderControl(hw);
                tb2.RenderControl(hw);
                tb3.RenderControl(hw);
                tb4.RenderControl(hw);
                tb8.RenderControl(hw);
                tb5.RenderControl(hw);
                tb6.RenderControl(hw);
                tb7.RenderControl(hw);
                sr.Write(tw.ToString());
                tw.Close();
                sr.Close();

                System.IO.FileInfo file 
= new System.IO.FileInfo(Path);
                Response.Clear();

                Response.AddHeader(
"Content-Disposition""attachment; filename=" + file.Name);


                Response.AddHeader(
"Content-Length", file.Length.ToString());

                Response.ContentType 
= "application/octet-stream";

                Response.WriteFile(file.FullName);

                Response.End();