Apache POI 或 docx4j 用于处理 docx 文档 [英] Apache POI or docx4j for dealing with docx documents

查看:82
本文介绍了Apache POI 或 docx4j 用于处理 docx 文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您认为将 docx 文档作为 java 对象读取哪个更好,为什么?

What do you think Which is better to use to read docx document as java objects and why ?

换句话说.哪个库支持大部分单词标签?

in other words. which library supports most of the word tags ?

推荐答案

披露:我领导 docx4j 项目

虽然 docx4j 也可以处理 pptx 和 xlsx,但它主要用于 docx 操作.举例说明,截至撰写本文时,docx4j 中有近 1000 个主题论坛.pptx 论坛只有 10% 的音量.

Although docx4j can also handle pptx and xlsx, it is mostly used for docx manipulation. By way of illustration, as at the time of writing, there are nearly 1000 topics in the docx4j forum. The pptx forum has only 10% of the volume.

无论您想对 docx 文档做什么,docx4j 都应该能够帮助您.有一个通用工作流程的单页概述.

Whatever you want to do with the docx document, docx4j ought to be able to help you. There's a single page overview of a generic workflow.

对于许多常见的需求,docx4j 提供了更高级别的 API.其中包括:

For many common requirements, docx4j provides higher level API. These include:

  • 创建/打开/保存 docx(当然)

  • Create/open/save docx (of course)

报告/文档生成,使用多种方法:(i) 变量替换,(ii) XML 数据绑定(特别强),以及 (iii) Mailmerge

Report/document generation, using a variety of approaches: (i) Variable substitution, (ii) XML data binding (particularly strong), and (iii) Mailmerge

导出为 HTML、XHTML

Export as HTML, XHTML

导出为 PDF(支持字体)

Export as PDF (with font support)

对于其他任何事情,您都可以根据自己的喜好操作 docx 的 JAXB 表示.JAXB 是 Java 社区标准,包含在 Java 6 中,并且在 EclipseLink 的 MOXy 中具有强大的替代实现.(POI 使用 XML Beans 而不是 JAXB)

For anything else, you can manipulate the JAXB representation of the docx to your heart's content. JAXB is a Java community standard, included in Java 6, and with a strong alternative implementation in EclipseLink's MOXy. (POI uses XML Beans instead of JAXB)

有一个网络应用来帮助您探索一个 docx,并生成 Java 代码以创建相应的 Java 对象.

There's a web app to help you explore a docx, and generate Java code to create corresponding Java objects.

当然,如果您有一些特定的任务,可能是 docx4j 或 POI 在那里具有特定的优势.

Of course, if there is some specific task you have in mind, it may be that docx4j or POI has a particular strength there.

docx4j 和 POI 均已获得 ASL v2 许可.

Both docx4j and POI are ASL v2 licensed.

docx4j 正在积极维护;它的源代码是 在 GitHub 上.

docx4j is actively maintained; its source code is on GitHub.

此外,如果您需要,可以为 docx4j 提供商业支持,还有一些商业扩展,例如 合并文档.

In addition, commercial support is available for docx4j if you want it, as are several commercial extensions eg MergeDocx.

docx4j 确实依赖 POI 作为 OLE 2 Compound 的其实现的库文档格式,我们很感激.

docx4j does rely on POI as a library for its implementation of the OLE 2 Compound Document format, which we're grateful for.

这篇关于Apache POI 或 docx4j 用于处理 docx 文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆