如何用Java编辑word文档
如何使用 Java 编辑 Word 文档?
How can you edit a word document with Java?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如何使用 Java 编辑 Word 文档?
How can you edit a word document with Java?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(6)
看看 http://poi.apache.org/
Take a look at http://poi.apache.org/
您也可以使用 COM 来做到这一点。使用 Java COM 互操作库,如 JACOB (JAVA COM BRIDGE): http://sourceforge.net/projects /jacob-project/
这是使用 Jacob 与 MS Word 对话的教程:http://www.land-of-kain.de/docs/jacob/
另一个看起来很有前途并且能够解决跨平台问题的库是 J-Interop:http://www.j-interop.org/。
You can use COM to do that also. Use a Java COM interop library like JACOB (JAVA COM BRIDGE): http://sourceforge.net/projects/jacob-project/
Here is a tutorial using Jacob to talk to MS Word: http://www.land-of-kain.de/docs/jacob/
The other library that looks promising and that will solve the cross-platform problem is J-Interop: http://www.j-interop.org/.
过去,我曾使用 OpenOffice.org 的 Java API 解决过此类问题。它并不完全是轻量级的,但许可条款很慷慨,并且它得到了开发社区的支持,该社区具有既得利益,确保它可以解析 Microsoft 对 Word 文件格式造成的任何奇怪现象。可能值得一看。
In the past, I've solved problems like this using OpenOffice.org's Java API. It's not exactly lightweight, but the licensing terms are generous and it has the backing of a development community with a vested interest in making sure it can parse whatever weirdness Microsoft inflicts on the Word file format. Might be worth a look.
我对任何标准都不熟悉。它还取决于Word的版本,因为不同版本使用不同的文件格式。
Apache 的 POI 项目 应该提供执行此操作的方法:
I'm not familiar with anything standard. It also depends on the version of Word, since various versions use different file formats.
The POI project from Apache is supposed to provide ways to do this:
您也可以尝试类似 SIKULI 的方法。
You could also try something like SIKULI.
您可以尝试 Docmosis,它允许您从 Java 填充或生成 Word 文档。它基于 BlairHippo 使用 OpenOffice API 的建议,但无需学习 api。 JODReports 类似。
You could try Docmosis, which allows you to populate or produce word docs from Java. It's based on BlairHippo's suggestion of using the OpenOffice API but without needing to learn the api. JODReports is similar.