Java 的 word 库

限制对比

docx4j

docx4j-getting-started

Docx4j can read/write docx documents created by or for Word 2007 or later, plus earlier versions which have the compatibility pack installed. (Same goes for xlsx spreadsheets and pptx presentations). The relevant parts of docx4j are generated from the ECMA schemas, with the addition of the key Microsoft proprietary extensions. For unsupported extensions, docx4j gracefully degrades to the specified 2007 substitutes. It is not really intended read/write Word 2003 XML documents, although package org.docx4j.convert.in.word2003xml is a proof of concept of importing such documents.

An effective approach is to use LibreOffice or OpenOffice (via jodconverter) to convert the doc to docx, which docx4j can then process. If you need to return a binary .doc, LibreOffice or OpenOffice/jodconverter can convert the docx back to .doc. With 8.2.0, docx4j can also convert binary .doc or RTF to docx, using Microsoft Word courtesy of documents4j. The sub-projects docx4j-documents4j-local and docx4j-documents4j-remote provide an interface to documents4j which is convenient for docx4j users.

只可以处理 07 上的版本,03 不支持。

Aspose.Words

System Requirements|Aspose.Words for Java

Any Operating System that can run the Java Runtime Environment (JRE) can run Aspose.Words for Java. The following table lists most, but not all, supported Operating Systems.
任何可以运行 Java 运行时环境 (JRE) 的操作系统都可以运行 Aspose.Words for Java。下表列出了大多数(但不是全部)支持的操作系统。

功能对比

  • Aspose.Words or Docx4j|Aspose.Words for Java
    • Docx4j 是一个开源 (ASLv2) Java 库,用于创建和操作 Microsoft Open XML Word 格式的文档。它类似于 Microsoft Open XML SDK for Java。 Docx4j 使用 JAXB 创建内存中对象表示,您需要一段时间才能理解 JAXB 和 Open XML 文件结构。
    • Aspose.Words 是一个非常有用的文档处理库,它为所有 Microsoft Word 和其他文档格式提供了强大的支持。使用 Aspose.Words,您可以查看、生成、修改、转换、渲染和打印文档,而无需使用 Microsoft Word。

Common Features

Release Aspose.Words Java for Docx4j - v1.0.0 · aspose-words/Aspose.Words-for-Java · GitHub

Examples for code comparison in Aspose.Words and Docx4j:

Working with Bookmarks

Working with Document

Working with Header and Footer

Missing Features of Docx4j

Examples for code with missing features in Docx4j in comparison with Aspose.Words:

Working with Documents

Working with Tables

Mail Merge

其他对比

容量大小

  • docx4j - 7mb
  • aspose.words - 16mb
    • aspose.cells - 8mb
    • aspose.pdf - 75mb

性能对比 todo

总结

限制对比:

  • 如果 aspose 的描述上没有问题,支持所有的版本,那么完胜

功能对比:

  • 通用功能 aspose 的抽象更好一点儿。
  • 功能丰富度 aspose 支持的更加的全面
    • 不支持的功能实现上,目前没有找到开源的方案

容量对比:

  • aspose 的大小稍大。可以接受

性能对比:

  • todo