Search in sources :

Example 1 with XSSFBSheetHandler

use of org.apache.poi.xssf.binary.XSSFBSheetHandler in project poi by apache.

the class XSSFBEventBasedExcelExtractor method processSheet.

/**
     * Processes the given sheet
     */
public void processSheet(SheetContentsHandler sheetContentsExtractor, XSSFBStylesTable styles, XSSFBCommentsTable comments, XSSFBSharedStringsTable strings, InputStream sheetInputStream) throws IOException, SAXException {
    DataFormatter formatter;
    if (getLocale() == null) {
        formatter = new DataFormatter();
    } else {
        formatter = new DataFormatter(getLocale());
    }
    XSSFBSheetHandler xssfbSheetHandler = new XSSFBSheetHandler(sheetInputStream, styles, comments, strings, sheetContentsExtractor, formatter, getFormulasNotResults());
    xssfbSheetHandler.parse();
}
Also used : XSSFBSheetHandler(org.apache.poi.xssf.binary.XSSFBSheetHandler) DataFormatter(org.apache.poi.ss.usermodel.DataFormatter)

Example 2 with XSSFBSheetHandler

use of org.apache.poi.xssf.binary.XSSFBSheetHandler in project poi by apache.

the class TestXSSFBReader method getSheets.

private List<String> getSheets(String testFileName) throws Exception {
    OPCPackage pkg = OPCPackage.open(_ssTests.openResourceAsStream(testFileName));
    List<String> sheetTexts = new ArrayList<String>();
    XSSFBReader r = new XSSFBReader(pkg);
    //        assertNotNull(r.getWorkbookData());
    //      assertNotNull(r.getSharedStringsData());
    assertNotNull(r.getXSSFBStylesTable());
    XSSFBSharedStringsTable sst = new XSSFBSharedStringsTable(pkg);
    XSSFBStylesTable xssfbStylesTable = r.getXSSFBStylesTable();
    XSSFBReader.SheetIterator it = (XSSFBReader.SheetIterator) r.getSheetsData();
    while (it.hasNext()) {
        InputStream is = it.next();
        String name = it.getSheetName();
        TestSheetHandler testSheetHandler = new TestSheetHandler();
        testSheetHandler.startSheet(name);
        XSSFBSheetHandler sheetHandler = new XSSFBSheetHandler(is, xssfbStylesTable, it.getXSSFBSheetComments(), sst, testSheetHandler, new DataFormatter(), false);
        sheetHandler.parse();
        testSheetHandler.endSheet();
        sheetTexts.add(testSheetHandler.toString());
    }
    return sheetTexts;
}
Also used : InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) XSSFBStylesTable(org.apache.poi.xssf.binary.XSSFBStylesTable) XSSFBSharedStringsTable(org.apache.poi.xssf.binary.XSSFBSharedStringsTable) XSSFBSheetHandler(org.apache.poi.xssf.binary.XSSFBSheetHandler) OPCPackage(org.apache.poi.openxml4j.opc.OPCPackage) DataFormatter(org.apache.poi.ss.usermodel.DataFormatter)

Example 3 with XSSFBSheetHandler

use of org.apache.poi.xssf.binary.XSSFBSheetHandler in project tika by apache.

the class XSSFBExcelExtractorDecorator method processSheet.

private void processSheet(SheetContentsHandler sheetContentsExtractor, XSSFBCommentsTable comments, XSSFBStylesTable styles, XSSFBSharedStringsTable strings, InputStream sheetInputStream) throws IOException, SAXException {
    XSSFBSheetHandler xssfbSheetHandler = new XSSFBSheetHandler(sheetInputStream, styles, comments, strings, sheetContentsExtractor, formatter, false);
    xssfbSheetHandler.parse();
}
Also used : XSSFBSheetHandler(org.apache.poi.xssf.binary.XSSFBSheetHandler)

Aggregations

XSSFBSheetHandler (org.apache.poi.xssf.binary.XSSFBSheetHandler)3 DataFormatter (org.apache.poi.ss.usermodel.DataFormatter)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 OPCPackage (org.apache.poi.openxml4j.opc.OPCPackage)1 XSSFBSharedStringsTable (org.apache.poi.xssf.binary.XSSFBSharedStringsTable)1 XSSFBStylesTable (org.apache.poi.xssf.binary.XSSFBStylesTable)1