除了将 Apache POI Java 用于 Microsoft Office 之外,还有其他选择吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4601722/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 07:10:00  来源:igfitidea点击:

Are there any alternatives to using Apache POI Java for Microsoft Office?

javams-officeapache-poi

提问by Nicholas

I discovered Apache POI for doing a lot with MS Office programmatically in Java, but its documentation leaves me wanting, as well as a few other things. Does a better alternative exist?

我发现 Apache POI 可以在 Java 中以编程方式使用 MS Office 做很多事情,但它的文档让我想要,以及其他一些东西。是否存在更好的替代方案?

I thought to myself that OpenOffice.org might have something, but cannot find any concise site that would have a Library that would allow you to open and store Word, Powerpoint, Excel, or other MS Office applications through Java.

我心想,OpenOffice.org 可能有一些东西,但找不到任何简洁的网站,它有一个库,允许您通过 Java 打开和存储 Word、Powerpoint、Excel 或其他 MS Office 应用程序。

Do any better alternatives exist?

是否存在更好的替代方案?

采纳答案by Nicholas

I think POI is the best among other libraries. I don't know the reason why you don't like it

我认为 POI 是其他图书馆中最好的。我不知道你为什么不喜欢它

Excel .xls & .xlsx

Excel .xls & .xlsx

HSSF is the POI Project's pure Java implementation of the Excel '97(-2007) file format. XSSF is the POI Project's pure Java implementation of the Excel 2007 OOXML (.xlsx) file format.

HSSF 是 POI 项目的 Excel '97(-2007) 文件格式的纯 Java 实现。XSSF 是 POI 项目的 Excel 2007 OOXML (.xlsx) 文件格式的纯 Java 实现。

Word .doc & .docx

Word .doc 和 .docx

HWPF is the name of our port of the Microsoft Word 97(-2007) file format to pure Java. It also provides limited read only support for the older Word 6 and Word 95 file formats. The partner to HWPF for the new Word 2007 .docx format is XWPF. Whilst HWPF and XWPF provide similar features, there is not a common interface across the two of them at this time.

HWPF 是我们将 Microsoft Word 97(-2007) 文件格式移植到纯 Java 的名称。它还为较旧的 Word 6 和 Word 95 文件格式提供有限的只读支持。新 Word 2007 .docx 格式的 HWPF 的合作伙伴是 XWPF。虽然 HWPF 和 XWPF 提供了类似的功能,但目前两者之间没有通用的接口。

anyway here are some libraries : Try Asposeand java2word

无论如何这里有一些库:尝试Asposejava2word

回答by Mark D

On the Aspose.cells site they offer a comparison to its open source competitors.

在 Aspose.cells 站点上,他们提供了与其开源竞争对手的比较。

http://www.aspose.com/docs/display/cellsjava/Aspose.Cells+for+Java+Vs+Open+Source+Competitors

http://www.aspose.com/docs/display/cellsjava/Aspose.Cells+for+Java+Vs+Open+Source+Competitors

They contrast with the following:

它们与以下内容形成对比:

JExcelAPI POI-HSSF

JExcelAPI POI-HSSF

Not an unbiased comparison probably but...

可能不是无偏见的比较,但是......

回答by JasonPlutext

I maintain docx4j, which is a strongly typed ASL v2 library for manipulating the XML file types (docx, pptx, xlsx) via JAXB.

我维护 docx4j,它是一个强类型 ASL v2 库,用于通过 JAXB 操作 XML 文件类型(docx、pptx、xlsx)。

If you also need to deal with the legacy binary formats (doc, ppt, xls), you'd need to pre-convert them to docx/pptx/xlsx before bringing docx4j to bear on them.

如果您还需要处理遗留的二进制格式(doc、ppt、xls),则需要在使用 docx4j 之前将它们预先转换为 docx/pptx/xlsx。

See more at Apache POI or docx4j for dealing with docx documents

Apache POI 或 docx4j 中查看更多有关处理 docx 文档的信息