本文介绍了ColdFusion - 将 HTML 网页转换为 Word 或 PDF 文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页,用户可以在其中打印此页面或将其保存在他/她的计算机上.

I have a webpage, where user has a possible to Print this page OR to save it on his/her computer.

如何将其保存为 Word 或 PDF 文档?

How may I save it as a Word or PDF document?

谢谢.

推荐答案

对于 MS Word 要求,大多数版本的 Office 可以解释基本的 html/xml.因此,您可能会将旧的 cfcontent hack 视为 POI 的更简单替代方案.(Word 包不如电子表格包成熟.)

For the MS Word requirement, most versions of Office can interpret basic html/xml. So you might consider the old cfcontent hack as a simpler alternative to POI. (The Word package is not quite as mature as the spreadsheet package.)

基本上你生成 html,但是使用 cfheader/cfcontent 来告诉浏览器内容实际上是一个 Word 文档.它显然不是真正的 MS Word 文件.但它比大多数选项更简单.

Basically you generate html, but use cfheader/cfcontent to tell the browser the content is really a Word document. It is obviously not a true MS Word file. But it is simpler than most options.

http://msdn.microsoft.com/en-us/library/aa155477.aspx

<cfheader name="Content-Disposition" value="attachment; filename=someFile.doc">
<cfcontent type="application/msword">
... your html code here ...

这篇关于ColdFusion - 将 HTML 网页转换为 Word 或 PDF 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 14:09