public void processFile(POIFSFileSystem filesystem, boolean listenForAllRecords)
throws IOException, SAXException {
// Set up listener and register the records we want to process
formatListener = new FormatTrackingHSSFListener(this);
HSSFRequest hssfRequest = new HSSFRequest();
if (listenForAllRecords) {
hssfRequest.addListenerForAllRecords(formatListener);
} else {
hssfRequest.addListener(formatListener, BOFRecord.sid);
hssfRequest.addListener(formatListener, EOFRecord.sid);
hssfRequest.addListener(formatListener, DateWindow1904Record.sid);
hssfRequest.addListener(formatListener, CountryRecord.sid);
hssfRequest.addListener(formatListener, BoundSheetRecord.sid);
hssfRequest.addListener(formatListener, SSTRecord.sid);
hssfRequest.addListener(formatListener, FormulaRecord.sid);
hssfRequest.addListener(formatListener, LabelRecord.sid);
hssfRequest.addListener(formatListener, LabelSSTRecord.sid);
hssfRequest.addListener(formatListener, NumberRecord.sid);
hssfRequest.addListener(formatListener, RKRecord.sid);
hssfRequest.addListener(formatListener, HyperlinkRecord.sid);
hssfRequest.addListener(formatListener, TextObjectRecord.sid);
hssfRequest.addListener(formatListener, FormatRecord.sid);
hssfRequest.addListener(formatListener, ExtendedFormatRecord.sid);
}
// Create event factory and process Workbook (fire events)
DocumentInputStream documentInputStream = filesystem.createDocumentInputStream("Workbook");
HSSFEventFactory eventFactory = new HSSFEventFactory();