如何将.xls和.csv文件编程转换为.xlsx? [英] How can I programatically convert .xls and .csv files to .xlsx?

查看:140
本文介绍了如何将.xls和.csv文件编程转换为.xlsx?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



更新:
此解决方案将部署在.Net商店中,因此现在PHP和Java方法不在桌面上(尽管我对图书馆本身印象深刻)。



我们将正在接收需要解析的csv,.xls和.xlsx格式的文档,并将其数据推入数据库。我们正在计划使用OpenXML SDK解决所有的解析情况,并希望仅通过一种文件类型进行操作。

解决方案

您可以使用 Apache POI库 来实现此目的


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



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


我已经使用它来阅读完整的 .xls .xlsx 文件的混合,我总是输出 .xlsx



对于 .csv 文件,导入使用 超级CSV库 ,并使用上面的Apache POI库导出。 p>


Super Csv的主要动机是成为Java中最好,最快速,最程序友好的免费CSV包。



Is there a programmatic solution to this that does not involve having Office on the server?

Update: This solution will be deployed in a .Net shop, so for now PHP and Java approaches aren't on the table (though I was impressed with the libraries themselves).

We will be receiving documents in csv, .xls, and .xlsx formats that need to be parsed and their data shoved into a DB. We're planning on using the OpenXML SDK for all of the parsing goodness and want to operate over only one file type.

解决方案

You can achieve this using the Apache POI library for Java.

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.

I've used it to read in a complete mix of .xls and .xlsx files, and I always output .xlsx.

For .csv files, import using the Super CSV library and export using the Apache POI library above.

The main motivation for Super Csv is to be the best, fastest and most programmer friendly free CSV package for Java.

这篇关于如何将.xls和.csv文件编程转换为.xlsx?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆