https://issues.apache.org/bugzilla/show_bug.cgi?id=57018
--- Comment #3 from [email protected] --- public ArrayList<ArrayList<String>> getSheetData() throws IOException, OpenXML4JException, ParserConfigurationException, SAXException { OPCPackage xlsxPackage = OPCPackage.open(fileName, PackageAccess.READ); ArrayList<ArrayList<String>> sheetData = new ArrayList<ArrayList<String>>(); ReadonlySharedStringsTable strings = new ReadonlySharedStringsTable( xlsxPackage); XSSFReader xssfReader = new XSSFReader(xlsxPackage); StylesTable styles = xssfReader.getStylesTable(); XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) xssfReader .getSheetsData(); int index = 0; if (iter.hasNext()) { InputStream stream = iter.next(); String sheetName = iter.getSheetName(); this.output.println(); this.output.println(sheetName + " [index=" + index + "]:"); sheetData = processSheet(styles, strings, stream); stream.close(); ++index; } return sheetData; } public ArrayList<ArrayList<String>> processSheet(StylesTable styles, ReadonlySharedStringsTable strings, InputStream sheetInputStream) throws IOException, ParserConfigurationException, SAXException { InputSource sheetSource = new InputSource(sheetInputStream); SAXParserFactory saxFactory = SAXParserFactory.newInstance(); SAXParser saxParser = saxFactory.newSAXParser(); XMLReader sheetParser = saxParser.getXMLReader(); ContentHandler handler = new MyXSSFSheetHandler(styles, strings, this.minColumns, this.output); sheetParser.setContentHandler(handler); sheetParser.parse(sheetSource); return ((MyXSSFSheetHandler) handler).getData(); } Used this logic to read the data -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
