Example usage for org.apache.poi.xssf.eventusermodel XSSFReader getSharedStringsTable

List of usage examples for org.apache.poi.xssf.eventusermodel XSSFReader getSharedStringsTable

Introduction

In this page you can find the example usage for org.apache.poi.xssf.eventusermodel XSSFReader getSharedStringsTable.

Prototype

public SharedStringsTable getSharedStringsTable() throws IOException, InvalidFormatException 

Source Link

Document

Opens up the Shared Strings Table, parses it, and returns a handy object for working with shared strings.

Usage

From source file:packtest.FromHowTo.java

License:Apache License

public void processFirstSheet(String filename) throws Exception {
    OPCPackage pkg = OPCPackage.open(filename, PackageAccess.READ);
    try {//from   ww  w . j  a  v  a  2 s . c o  m
        XSSFReader r = new XSSFReader(pkg);
        SharedStringsTable sst = r.getSharedStringsTable();

        XMLReader parser = fetchSheetParser(sst);

        // process the first sheet
        InputStream sheet2 = r.getSheetsData().next();
        InputSource sheetSource = new InputSource(sheet2);
        parser.parse(sheetSource);
        sheet2.close();
    } finally {
        pkg.close();
    }
}