Does anyone know if it's possible to add VB to an Excel document, from within Java? I basically want to add a pivot table to a sheet, and set some of it's properties dynamically. I know that I can access the pivot table settings from VB, but not directly from POI.
+3
A:
I've done something similar, where I've created a spreadsheet with VBA in advance using Excel. I then load it using POI, populate the values and then save it out again. Thus I get a spreadsheet with the populated values and the preconfigured VB/macros etc.
Perhaps you need to create your VBA in advance, and it will read its dynamic properties from the sheet. You can then populate these properties at will.
Brian Agnew
2009-05-04 10:19:51