0
votes

I want to generate an excel workbook with a sheet of raw data and create a pivot table from that data.

The columns are dynamic, which means that the pivot table is as well. Therefore, I cannot use a static template and refresh it. I have come across couple of commercial libraries (smartXLS and aspose.cells), that can do that.

My question is if x4j-analytic (https://github.com/jbaliuka/x4j-analytic) can handle dynamic pivot table, i.e. define row/column/data fields at runtime and not just from a static template. All examples seem to suggest it is static.

Is there any other ope-source library that can do this?

1
Actually Excel supports dynamic columns in pivot table, simply use additional field and let Excel to format it as columnsjbaliuka
@jbaliuka I know Excel supports that, but the apache poi does not. Do you mean to create the template dynamically and then use the x4j?gdiamantidis
I think static template should work if you will change data source to return all dynamic fields as regular values in special static column.jbaliuka
@jbaliuka I haven't worked on that for a while. If I get the chance to try it out I will comment here. Thank you for your help.gdiamantidis

1 Answers

0
votes

I have found a patch for apache poi, which x4j-analytic is based on, that adds/extends pivot table functionality. This is the link to the poi pivot table patch

I created a new project adding the existing classes applied the patch on top and generated a shaded jar excluding those patched classes (maven-shade-plugin).

Alternatively get the apache poi source and make your changes, but I preferred the shaded plugin.