在 Ruby 中以编程方式输出 Word 文档格式的文件的最佳方法是什么?

发布于 2024-07-17 21:03:59 字数 107 浏览 3 评论 0原文

我需要根据应用程序中的一些文本内容从基于 Ruby 的 Web 应用程序 (Rails/Sinatra) 输出 Word 文档格式的文件。 Ruby 中是否有用于创建和构建 Word 文档的库支持?

I need to output a file in the format of a Word document from a Ruby-based web app (Rails/Sinatra) based on some textual content in the app. Is there library support in Ruby for creating and structuring a Word document?

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

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

发布评论

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

评论(3

笑饮青盏花 2024-07-24 21:03:59

查看 XML 格式 WordML对于 Word 文件。

John Durant 的博客提供了有用的WordML 和常见问题解答资源列表

演练:Word 2007 XML 格式

用于创建 XSLT 转换的有用工具:Office 2003 工具:WordprocessingML转换推理工具

这些 SO 帖子可能也令人感兴趣:

风和你 2024-07-24 21:03:59

您没有具体说明“Word 文档”的确切含义。 它是 Word 2003 风格的 doc 文件吗? 它是 Word 2007 docx 文件吗? 它只是 Word 可以打开而不支持样式的东西吗?

如果您想要后者,您可以使用 RTF,这比 doc 格式更容易一些。 有一个名为 Ruby RTF 的库,它应该可以满足您的需求,尽管老实说我从未使用过我自己。

You don't specify what "a Word document" means exactly. Is it a Word 2003-style doc file? Is it a Word 2007 docx file? Is it just something Word can open than supports styling?

If the latter is what you want, you could use RTF, which is somewhat easier than the doc format. There is a library called Ruby RTF that should do what you want, though I've honestly never used it myself.

诗化ㄋ丶相逢 2024-07-24 21:03:59

生成 Word 2003 文档会更容易吗:是否有一种更容易理解的基本 Word 2003 .doc 文件格式,不需要 XML 等方面的博士学位?

Would it be easier to generate a Word 2003 document: Is there an easier to understand file format for a basic Word 2003 .doc that doesn't require a PhD in XML, etc?

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