本文介绍了哪个是更好的 Java 中 Excel 文件解析的开源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Java Apache POI 或 JExcel API 中哪个更好的 API 用于 excel 解析?在速度、内存利用率和代码稳定性方面.

Which is better API for excel parsing in Java Apache POI or JExcel API?In terms of speed, memory utilization and code stability.

推荐答案

我个人更推荐 POI 而不是 JExcel.我选择 POI 而不是 JExcelAPI 的原因是:

Personally I would recommend POI over JExcel. The reasons I chose POI over JExcelAPI are:

  1. POI 支持新旧 MS Excel 工作表格式
  2. 它有一个更干净的 API(恕我直言)
  3. 据我所知,它没有受到 JexcelApi 所具有的恼人的日期\时间问题的困扰 (日期显示).

我有机会同时使用两者.在我看来,POI 具有经过深思熟虑且易于使用的 API.从我的角度来看,最大的好处是您可以工厂关闭工作表实例的创建,然后在用户模型界面的上下文中处理所有内容.这意味着您的代码可以处理旧的和新的 Excel 文件格式,而无需担心哪种格式.

I have had the opportunity to use both. POI, in my opinion, has a really well thought out and easy to use API. The biggest benefit from my perspective is that you can factory off the creation of the worksheet instance and then deal with everything in the context of the usermodel interfaces. This means your code can process both old and new Excel file formats without having to worry about which is which.

此外,您还可以读取和写入相同的 Worksheet 实例.使用 JExcelApi 时,可读"工作表和可写"工作表之间存在这种非常奇怪的分裂,我觉得这很奇怪.这也导致我不得不引入凌乱的变通方法,以便在我的代码中从阅读"转向写作".

Additionally, you are able to read and write the same Worksheet instance. With JExcelApi there is this really strange split between "readable" sheets and "writable" sheets which I found odd. This also resulted in me having to introduce messy work arounds to move from "reading" to "writing" in my code.

我没有注意到在旧的二进制文件 (POI HSSF) 和 JExcelApi 上使用 POI 的有意义的性能差异.然而,POI HSSF(旧格式)和 POI XSSF(新格式)之间存在显着的性能差异.我认为这是因为解包和解析 XML 所需的所有额外工作.

I did not notice meaningful performance difference using POI on old, binary files (POI HSSF) and JExcelApi. There is however a significant performance difference between POI HSSF (old format) and POI XSSF (new format). I assume this is because of all the extra work required for unpacking and parseing XML.

这篇关于哪个是更好的 Java 中 Excel 文件解析的开源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 17:27