List of usage examples for org.apache.poi.xssf.eventusermodel XSSFSheetXMLHandler XSSFSheetXMLHandler
public XSSFSheetXMLHandler(Styles styles, SharedStrings strings, SheetContentsHandler sheetContentsHandler, DataFormatter dataFormatter, boolean formulasNotResults)
From source file:mj.ocraptor.extraction.tika.parser.microsoft.ooxml.XSSFExcelExtractorDecorator.java
License:Apache License
public void processSheet(SheetContentsHandler sheetContentsExtractor, StylesTable styles, ReadOnlySharedStringsTable strings, InputStream sheetInputStream) throws IOException, SAXException { InputSource sheetSource = new InputSource(sheetInputStream); SAXParserFactory saxFactory = SAXParserFactory.newInstance(); try {//from w w w . j a va 2 s .c o m SAXParser saxParser = saxFactory.newSAXParser(); XMLReader sheetParser = saxParser.getXMLReader(); XSSFSheetInterestingPartsCapturer handler = new XSSFSheetInterestingPartsCapturer( new XSSFSheetXMLHandler(styles, strings, sheetContentsExtractor, formatter, false)); sheetParser.setContentHandler(handler); sheetParser.parse(sheetSource); sheetInputStream.close(); if (handler.hasProtection) { metadata.set(TikaMetadataKeys.PROTECTED, "true"); } } catch (ParserConfigurationException e) { throw new RuntimeException("SAX parser appears to be broken - " + e.getMessage()); } }