如何用ruby解析word文档?

发布于 2024-07-10 16:28:59 字数 127 浏览 4 评论 0 原文

有谁知道我可以在 OS X/Linux 上使用的库来解析 Word 文件并将内容输出为 HTML?

我查看过 win32ole,但据我所知它仅适用于 Windows,尽管我可能是错的。

有什么建议么?

Does anyone know of a library that I can use on OS X/Linux to parse Word files and output the content as HTML?

I've had a look at win32ole but as far as I can see it's for Windows only, although I could be wrong.

Any suggestions?

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

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

发布评论

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

评论(1

つ可否回来 2024-07-17 16:28:59

Word 文档格式(暂时忽略 docx)很糟糕并且在不断变化。 恕我直言,这就是为什么解析它们的 Ruby 库如此之少(读作:零)。

我建议使用 JRuby 和一些已建立的 Java 库来读取文档格式。 Google 应该可以帮助您:http://schmidt.devlib.org/java/libraries- word.html

有一个用于读取 MIcrosoft 文件格式的 Java 项目 POI (http://poi.apache.org/)并且它们确实有 Ruby 绑定 (http://poi.apache.org/poi-ruby.html< /a>)但我不确定这些是最新的。 在他们的网站上,它说 Ruby 绑定适用于 1.8.2...

The Word document format (ignoring docx for the moment) is terrible and was constantly changing. IMHO that is why there are so few (read: zero) Ruby libraries out there to parse them.

What I recommend doing is using JRuby and some of the established Java libraries for reading the doc format. Google should help you out there: http://schmidt.devlib.org/java/libraries-word.html.

There is a Java project for reading MIcrosoft file formats, POI (http://poi.apache.org/) and they do have Ruby bindings (http://poi.apache.org/poi-ruby.html) but I'm not sure how up-to-date those are. On their site it says the Ruby bindings are for 1.8.2...

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