This is the case: I have to use SXSSFWorkbook (Streaming version of XSSFWorkbook) to create my Excel, because I have to create a sheet with 700000/800000 rows with about 20 columns. This sheet represents the source table for my final Pivot.
SXSSFWorkbook workbook();
XSSFSheet pivotSheet = workbook.getXSSFWorkbook().createSheet("Pivot sheet");
AreaReference ar = ....:
CellReference cr = ....;
XSSFPivotTable pivotTable = pivotSheet.createPivotTable(ar, cr); // ERROR!!
The problem is that, when I try to create this Pivot on that source, the XSSFPivotTable.createPivotTable method not work, despite AreaReference and CellReference arguments are ok.
If I use XSSFWorkbook (not streaming version) with less rows, all is ok, but I do not reach my goal!
Can someone give me a solution? Thank you very much!!!!!
Stefano
SXSSFWorkbook can be created from
XSSFWorkbook
.So what I would do is creating
XSSFWorkbook
having aXSSFSheet
with at least the headings of the data and anotherXSSFSheet
for the pivot table. Then creating theXSSFPivotTable
on thisXSSFSheet
but making the reference to the data sheet big enough for later data.Then I would creating the
SXSSFWorkbook
from thisXSSFWorkbook
, getting the data sheet asSXSSFSheet
and then streaming the big amount of data into the data sheet.Complete example: