poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Osmosis Paul <politr...@hotmail.com>
Subject Create a XSSFWorkbook from a XSSFReader
Date Tue, 03 Aug 2010 16:08:18 GMT

well in general that i'm trying is get an xlsx file load with XSSF and when i
have an object XSSFReader by the OPCPackage,iterate and modify, every sheet,
and then create a new XSSFWorkbook, load over him the modification
information, and update or create a new file.
The first problem that i had has been i remark if you dont mind in code:

 ReadonlySharedStringsTable strings = new
        XSSFReader xssfReader = new XSSFReader(this.xlsxPackage);
        StylesTable styles = xssfReader.getStylesTable();
        XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator)
        int index = 0;
        while (iter.hasNext()) {
            InputStream stream = iter.next();
            XSSFWorkbook wb = new XSSFWorkbook(stream);  //Here have the
            String sheetName = iter.getSheetName();
            this.output.println(sheetName + " [index=" + index + "]:");
            processSheet(styles, strings, stream);

The error that i recieve is this:
Exception in thread "main"
org.apache.poi.openxml4j.exceptions.InvalidOperationException: Can't open
the specified file:
	at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:102)
	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:199)
	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:178)
	at org.apache.poi.util.PackageHelper.open(PackageHelper.java:53)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:144)
	at org.apache.poi.xssf.eventusermodel.XLSX2CSV.process(XLSX2CSV.java:519)
	at org.apache.poi.xssf.eventusermodel.XLSX2CSV.main(XLSX2CSV.java:624)

Thanks everyone for the help
View this message in context: http://old.nabble.com/Create-a-XSSFWorkbook-from-a-XSSFReader-tp29337197p29337197.html
Sent from the POI - Dev mailing list archive at Nabble.com.

To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org

View raw message