use of org.apache.poi.hssf.eventusermodel.HSSFRequest in project poi by apache.
the class XLS2CSVmra method process.
/**
* Initiates the processing of the XLS file to CSV
*/
public void process() throws IOException {
MissingRecordAwareHSSFListener listener = new MissingRecordAwareHSSFListener(this);
formatListener = new FormatTrackingHSSFListener(listener);
HSSFEventFactory factory = new HSSFEventFactory();
HSSFRequest request = new HSSFRequest();
if (outputFormulaValues) {
request.addListenerForAllRecords(formatListener);
} else {
workbookBuildingListener = new SheetRecordCollectingListener(formatListener);
request.addListenerForAllRecords(workbookBuildingListener);
}
factory.processWorkbookEvents(request, fs);
}
use of org.apache.poi.hssf.eventusermodel.HSSFRequest in project poi by apache.
the class TestAbortableListener method testAbortStops.
public void testAbortStops() throws Exception {
AbortableCountingListener l = new AbortableCountingListener(1);
HSSFRequest req = new HSSFRequest();
req.addListenerForAllRecords(l);
HSSFEventFactory f = new HSSFEventFactory();
assertEquals(0, l.countSeen);
assertEquals(null, l.lastRecordSeen);
POIFSFileSystem fs = openSample();
short res = f.abortableProcessWorkbookEvents(req, fs);
assertEquals(1234, res);
assertEquals(1, l.countSeen);
assertEquals(BOFRecord.sid, l.lastRecordSeen.getSid());
}
Aggregations