简体   繁体   中英

Open excel-xml with apache poi

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM