如何用ruby解析word文档?
有谁知道我可以在 OS X/Linux 上使用的库来解析 Word 文件并将内容输出为 HTML?
我查看过 win32ole,但据我所知它仅适用于 Windows,尽管我可能是错的。
有什么建议么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
有谁知道我可以在 OS X/Linux 上使用的库来解析 Word 文件并将内容输出为 HTML?
我查看过 win32ole,但据我所知它仅适用于 Windows,尽管我可能是错的。
有什么建议么?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
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...