I am trying to read Excel (xls and xlsx) files Row by Row using POI 3.5. The POI User model APIs (aka DOM) loads the whole set of rows into the Memory (Java Heap) which I don't want to happen.
Using POI HSSF Event model APIs for XLS format, I tried with AbortableHSSFListener so that I can abort the processing as soon as I am done with a row. But I ran into issue with AbortableHSSFListener as it doesn't emit records for missing rows and cells and end of row records. If I try to use MissingRecordAwareHSSFListener, this doesn't work with AbortableHSSFListener instead invokes the processRecord(Record record) on the child listener. When I try to write my own Abortable MissinfRecordAware Listener similar to MissingRecordAwareHSSFListener, I found that it can emit LastCellOfRowDummyRecord to notify the End of Row, only after reading the cell of the next row or the beginning of the next sheet or the EOFRecord. If I want to pause the processing until the caller request for the next record, I will have to push back the last read record back into the stream which I am not aware of any lowel level POI APIs for the same. Using POI XSSF Event model APIs for XLSX format, I have only option with SAX Parser (because I am using JDK5) which doesn't support pause and resume. I know with JDK 6 Stax XML APIs, I could do pause and resume. Please let me know if any of you know to use POI 3.5 to read row by row and pause the processing after reading and returning the row to the caller until the caller request for the next. Thanks Ajay -- View this message in context: http://apache-poi.1045710.n5.nabble.com/Reading-Excel-xls-and-xlsx-files-Row-by-Row-tp5128945p5128945.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
