excel-streaming-reader
excel-streaming-reader copied to clipboard
DataFormat : StreamingWorkbook#createDataFormat()
First of all I (being pained by OOMs due to POI Excel imports ;) ) would like to say how impressed I am by the low footprint of this streaming reader.
Unfortunately we need to access
workbook.createDataFormat().getFormat( dataFormatNr )
to get cell (formatting) details. But StreamingWorkbook#createDataFormat() is not supported and hence throws UnsupportedOperationException()
What would be the "right way" to get the DataFormat of a workbook?
I have just noticed that the StreamingWorkbookReader has the sytles(Table). What if these became a new field (instead of the local variable) and would be provided through
StreamingWorkbookReader#getStylesTable()
?
Then StreamingWorkbook
could implement createDataFormat
as follows:
public DataFormat createDataFormat() {
if (formatter == null) {
formatter = new StreamingDataFormat(reader.getStylesTable());
}
return formatter;
}
StreamingDataFormat
being a copy of XSSFDataFormat
That certainly sounds like it could work. I don't have a workbook to test with though, would you be able to implement this in a PR and include one?
would you be able to implement this in a PR
me being git newbie, I hope you can live with a simple patch?