生成 DOC 文件的最简单方法是什么?

发布于 2024-08-07 16:29:22 字数 230 浏览 3 评论 0原文

现在我正在使用 Perlscript 生成 HTML,然后在 OpenOffice 中手动转换为 DOC。实际上我必须复制、创建新的“文本文档”、粘贴、保存,因为它将 HTML 和 DOC 视为单独的文件类型,但这是非常不必要的。这非常不方便。

是否有任何自动方法可以将 HTML 转换为合适的 DOC,或者其他一些不错的格式(例如我可以生成文本并以自动方式转换为 DOC 的 HTML)?

(我在 OSX 上)

Right now I'm generating HTML with a Perlscript, and then manually converting to DOC in OpenOffice. Actually I have to copy, create new "Text document", paste, save, as it treats HTML and DOC as separate file types, but that's quite unessential. That's very inconvenient.

Is there any automated way I can convert HTML to decent DOC, or some other nice format like HTML I can generate textually and convert to DOC in automated way?

(I'm on OSX)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

终弃我 2024-08-14 16:29:22

我无法帮助您访问 .doc,但是您是否看过 来自 Microsoft 的开放 XML 格式 SDK?这将允许您从 .NET 代码生成 Office 2007 格式文档(.docx、.xlsx 等)。

理论上,您可能会在 OS X 上的 Mono 下幸运地使用此功能,因为它不需要安装 Office 2007(适用于 Windows)即可运行。

I can't help you get to .doc, but have you seen the Open XML Format SDK from Microsoft? This will allow you to generate Office 2007 format documents (.docx, .xlsx etc) from .NET code.

Theoretically you may have some luck with this under Mono on OS X, as it doesn't require an installation of Office 2007 (for Windows) to function.

凉城凉梦凉人心 2024-08-14 16:29:22

不确定这是否是您想要的,但您可以相当轻松地使用代码生成 WordML 文档。 WordML 是 Word 2003 XML 文件格式。这与 Office 2007 Open XML 格式不同。 WordML 只是一个文件,如果您只进行相当基本的格式化,那么创建它并不难。您可以直接生成它,而不是先创建 HTML。您可以使用 .DOC 扩展名命名这些文件,然后 Word 2003 就可以正常打开它们。如果需要,您可以将它们重新保存为真正的 .DOC 文件。

这是在线 WordML 参考。如果您愿意,我可以向您发送一些示例代码。
http://msdn.microsoft.com/en-us /library/aa212812(office.11​​).aspx

如果您确实想创建可以转换为其他格式的通用文件格式,那么创建 XML-FO 文件可能是最佳选择。有许多产品可以采用 XML-FO 并将其转换为其他文件,例如 Word 和 PDF。

Not sure if this is what you want, but you can fairly easily generate WordML documents with code. WordML is the Word 2003 XML file format. It's NOT the same thing at the Office 2007 Open XML formats. WordML is just one file that's not too hard to create if your just doing fairly basic formatting. You could generate it directly rather than creating the HTML first. You can name the files with a .DOC extension and Word 2003 and later will open them just fine. You can resave them as real .DOC file if you want.

Here's the on-line WordML reference. I can send you some sample code if you'd like.
http://msdn.microsoft.com/en-us/library/aa212812(office.11).aspx

If you really want to create a general file format that could be converted into other formats, creating XML-FO file might be the way to go. There are a number of products out there that can take XML-FO and transform it into other files, such as Word and PDF.

撞了怀 2024-08-14 16:29:22

我们确实使用可用于 .NET 和 Java 的 Aspose 组件。通过 Java,您也应该能够在 OS X 上使用它们。

你必须购买组件(即它们不是免费的),但除此之外,它们真的很棒。

We do use the components of Aspose that are available for .NET and Java. With Java you should be able to use them on OS X, too.

You have to purchase the components (i.e. they are not free), but aside from this, they are really great.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文