4
votes

User can save excel document as .xls or as xml-table. Result is a xml-file with fixed structure and Excel can correct work with it.

It is possible open this type of excel file with apache-poi in java?

Thanks in advance, Andrey.

1
What was your attempt ?vels4j
I have no idea how to.Андрей Крюков

1 Answers

5
votes

If you mean with XML-table a file like this (created by using the Save as option in Excel):

<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">

Then the answer is: No, you can't open this with Apache POI.

POI supports Microsoft Excel 97(-2007) (BIFF8) .xls and Microsoft Excel XML (2007+) (OOXML) .xlsx file formats.

The first one is a binary format, the second is a ZIP file format with a bunch of XML files in it. (To have a look at it: Rename a .xlsx file to .zip and open it using a ZIP tool)

I only know of a .NET/C# Tool that is able to convert that XML schema to an Excel format, that then could be read by POI: http://spreadsheet.codeplex.com/

Maybe there are other converters out there, you may have look using Google on it.