在 Java 中将 Excel xlsx 转换为 xls

发布于 2024-08-19 07:20:41 字数 423 浏览 8 评论 0原文

我有一个 Excel 2007 xlsx 文件,我想以编程方式将其转换为 .xls 文件。 xlsx 文件是从报告工具导出的,我想将其转换为 xls,以便更好地与我的应用程序用户的软件堆栈兼容。 xlsx 就这么简单。仅包含数据和基本类型信息(整数/日期/字符串)的行。没有公式。

我的平台是Java,并且没有安装Microsoft Office。我正在寻找一种解决方案,使我能够以最少的努力在格式之间进行转换。即,我想避免编写一个自定义的“复制应用程序”来读取 xlsx 文件并将行和格式复制到另一个文件。优选地,该解决方案是开源的和/或免费的。

我查看了 POI,据我所知,它可以读取和写入 xls 和 xlsx 文件。但我无法通过浏览文档和示例来判断它是否可以读取一种格式并以另一种格式写出。在我深入研究之前,我想检查一下你们中是否有人以前用 Java 做过类似的事情,以及你们是否有任何技巧。

I have an Excel 2007 xlsx file that I would like to programmatically convert to an .xls file. The xlsx file is an export from a reporting tool, and I would like to convert it to xls for better compatibility with the software stack of my application users. The xlsx is as plain as it gets. Just rows with data and basic type information (int/date/string). No formulas.

My platform is Java, and I do not have Microsoft Office installed. I'm looking for a solution that will allow me to convert between the formats with the least amount of effort. I.e. I'd like to avoid having to write a custom "copy application" that would read the xlsx file and copy the rows and formatting to another file. Preferably, the solution is open source and/or free.

I have looked at POI, and as far as I could tell, it can read and write both xls and xlsx files. But I was not able to tell by browsing the documentation and examples if it could read one format and write out in the other. Before I dig in any deeper, I would like to check if any of you out there have done anything like this before in Java, and if you have any tips.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抹茶夏天i‖ 2024-08-26 07:20:41

使用 POI 进行转换将是一项繁琐的任务。我想向您推荐 JODConverter。 OpenOffice 使用 JODConverter 来转换其内容,因此它应该可以很好地完成该任务。

不过,话虽这么说,我自己还没有使用过 JODConverter。

Converting with POI would be a tedious task. I would like to point you to JODConverter. JODConverter is used by OpenOffice to convert its stuff, so it should work fine for that task.

However, that being said, I have not used JODConverter myself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文