Excel biff5 to biff8 conversion

2019-06-21 16:21发布

问题:

My system uses Apache-POI to manage some xls files. Now I've got almost 300 xls files, but it appears that they are in an old format so i got this exception:

The supplied spreadsheet seems to be Excel 5.0/7.0 (BIFF5) format. POI only supports BIFF8 format (from Excel versions 97/2000/XP/2003)

Is there a way to handle that or to automatically convert all those files to a biff8 format?

回答1:

Go with converting it to OOXLS format, POI supports both BIFF8 and newer OOXLS. Download official Microsoft converter pack:

http://www.microsoft.com/en-us/download/details.aspx?id=3

Convert files by running excelcnv.exe -oice <input file> <output file>. You can try run it directly from your code as external program, or create some batch file. There is a good explanation from mrdivo at social msdn here.

EDIT

The download mentioned above from microsoft.com is no longer available as of 6/21/2018. However, excelcnv.exe is a standard part of some Microsoft Office installations. It has been confirmed to be deployed with Office 2014 and Office 2016, and possibly other versions. It can be found at:

C:\Program Files (x86)\Microsoft Office\root\Office16` (or `Office14`).


回答2:

It seems apache-POI can't handle BIFF5 format.

You should try to use Java Excel API instead : http://jexcelapi.sourceforge.net/