将网页到出word文档,全面兼容所有office版本的代码

xuhaijin 2009-05-26 07:31:40
将网页到出word文档,全面兼容所有office版本的代码
...全文
57 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaojing7 2009-05-30
  • 打赏
  • 举报
回复
http://topic.csdn.net/t/20060326/21/4641413.html
修改一下昵称 2009-05-28
  • 打赏
  • 举报
回复
路过帮顶...ing
blestcc 2009-05-27
  • 打赏
  • 举报
回复
有這種好東西?
wuyq11 2009-05-26
  • 打赏
  • 举报
回复
public void ExpertControl(System.Web.UI.Control source, DocumentType type)

{
if (type == DocumentType.Excel)
{
Response.AppendHeader("Content-Disposition","attachment;filename=result.xls");
Response.ContentType = "application/ms-excel";
}
else if (type == DocumentType.Word)
{
Response.AppendHeader("Content-Disposition","attachment;filename=result.doc");
Response.ContentType = "application/ms-word";
}
Response.Charset = "utf-8";
Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
source.Page.EnableViewState =false;
System.IO.StringWriter writer = new System.IO.StringWriter() ;
System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(writer);
source.RenderControl(htmlWriter);
Response.Write(writer.ToString());
Response.End();
}
public enum DocumentType
{
Word,
Excel
}
参考
参考
a12321321321312321 2009-05-26
  • 打赏
  • 举报
回复
顶下。没有做过
Office2003通用兼容包(office2003兼容office2007、office2010)在装有Microsoft Office 2000、Office XP或Office 2003的计算机上安装该兼容包之后,就可以采用Word、Excel 和 PowerPoint 2007/2010新增的文件格式打开、编辑和保存文件。该兼容包还可以与Microsoft Office Word Viewer 2003、Excel Viewer 2003和PowerPoint Viewer 2003配合使用,用来查看以这些新格式保存的文件。有关该兼容包的更多信息,请参阅知识库文章923505。 Microsoft Office XP 和 2003 系统 Word、Excel 或 PowerPoint 程序的用户 — 首先从 Microsoft Update 安装所有高优先级的更新,然后下载兼容包。 注意:如果您使用 Microsoft Word 2000 或 Microsoft Word 2002 阅读或编写包含复杂文种的文档,了解如何在您的 Word 版本中正确显示 Word 2007/2010文档。 管理员:可以下载该兼容包中包含的Word、Excel 和 PowerPoint转换器管理模板。 Office2003通用兼容包(office2007兼容包,office2010兼容包)支持的操作系统: Windows 2000 Service Pack 4; Windows Server 2003; Windows XP Service Pack 1 Office2003通用兼容包推荐的 Microsoft Office 程序: Microsoft Word 2000 Service Pack 3、Microsoft Excel 2000 Service Pack 3 和 Microsoft PowerPoint 2000 Service Pack 3 Microsoft Word 2002 Service Pack 3、Microsoft Excel 2002 Service Pack 3 和 Microsoft PowerPoint 2002 Service Pack 3 Microsoft Office Word 2003 Service Pack 1 或更高版本、Microsoft Office Excel 2003 Service Pack 1 或更高版本、Microsoft Office PowerPoint 2003 Service Pack 1 或更高版本 Microsoft Office Word Viewer 2003 Microsoft Office Excel Viewer 2003 Microsoft Office PowerPoint Viewer 2003

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧