在Excel中将Excel xlsx转换为xls

时间:2021-05-05 14:04:17

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.

我有一个Excel 2007 xlsx文件,我想以编程方式转换为.xls文件。 xlsx文件是从报告工具导出的,我想将其转换为xls,以便与我的应用程序用户的软件堆栈更好地兼容。 xlsx就像它得到的一样简单。只包含数据和基本类型信息的行(int / date / string)。没有公式。

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.

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

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.

我看过POI,据我所知,它可以读写xls和xlsx文件。但我无法通过浏览文档和示例来判断它是否可以读取一种格式并在另一种格式中写出来。在我深入挖掘之前,我想检查一下你们之前是否有人在Java之前做过这样的事情,如果你有任何提示。

1 个解决方案

#1


3  

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.

转换POI将是一项繁琐的工作。我想指出JODConverter。 OpenOffice使用JODConverter来转换它的东西,所以它应该适用于该任务。

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

然而,话虽如此,我自己没有使用过JODConverter。

#1


3  

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.

转换POI将是一项繁琐的工作。我想指出JODConverter。 OpenOffice使用JODConverter来转换它的东西,所以它应该适用于该任务。

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

然而,话虽如此,我自己没有使用过JODConverter。