File inputFile = null; // ######################
// FileInputStream fileInStream = null;
POIFSFileSystem fileInStream = null;
Workbook workbook = null;
Sheet sheet = null;
Row row = null;
Cell cell = null;
Iterator<Row> rowIterator = null;
Iterator<Cell> cellIterator = null;
int numSheets = 0;
try {
inputFile = new File("O:\\test.xlsx"); // #######################
fileInStream = new POIFSFileSystem(new FileInputStream(inputFile));
workbook = WorkbookFactory.create(fileInStream);
......
numSheets = workbook.getNumberOfSheets(); // number of sheets
for (int i = 0; i < numSheets; i++) { // Zählerschl. durch Formulare
sheet = workbook.getSheetAt(i); // get the sheet
rowIterator = sheet.iterator();
while (rowIterator.hasNext()) { // durch die Reihen
row = rowIterator.next();
System.out.println("Zeilennummer: " + row.getRowNum());
cellIterator = row.iterator(); // Iterator um durch die
// Zellen der Zeile zu iterieren
while (cellIterator.hasNext()) { // durch die Zellen
// iterieren
cell = cellIterator.next();
System.out.println("Cell: " + cell.toString());
}
}
}
.......
Fehler gefunden !!
Bezeichnung: org.apache.poi.poifs.filesystem.OfficeXmlFileException
Message: The supplied data appears to be in the Office 2007+ XML. POI only supports OLE2 Office documents
die weitere Meldung folgt.........
org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the Office 2007+ XML. POI only supports OLE2 Office documents
at org.apache.poi.poifs.storage.HeaderBlockReader.<init>(HeaderBlockReader.java:96)
at org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>(POIFSFileSystem.java:84)
at openwithxssf.main(openwithxssf.java:30)
eingebunden..!!!! ???:LO:\javalibs\poi-ooxml-3.5-beta5.jar
O:\javalibs\poi-3.0-rc4-20070503.jar
O:\javalibs\poi-3.5-beta3.jar
O:\javalibs\ooxml-lib 3.5 beta6\geronimo-stax-api_1.0_spec-1.0.jar
O:\javalibs\ooxml-lib 3.5 beta6\ooxml-schemas-1.0.jar
O:\javalibs\ooxml-lib 3.5 beta6\xmlbeans-2.3.0.jar
We are currently working to support the new Office Open XML file formats, such as XLSX and PPTX, which were introduced in Office 2007.
Development for this is in a svn branch, but we are please to announce our first preview release containing this support. Users interested in the OOXML support should download the POI 3.5 beta 6 the source and binaries from their local mirror. People interested should also follow the dev list to track progress.