In my last post I wrote about how to in some simple steps generate an automated export of an view to excel. In this post I will show you how to fine grain this using the excel component instead.
Start by creating a blank excel file note what the sheet you want to place data on is called usually Sheet1 if you have an english version of Excel. Save and import it as a file resource in the database, name it export.xlsx
Now create a new XPage add a button and the Excel component POI Workbook
This is how the result should look
Now add a simple action to the Export button
Select the Excel Component and go to all properties and create a new resource template
In the resource template specify the name of your excel template
The template is now ready to be used and we can now move over to setup the actual data that should be added to the spreadsheet. create a new dominoViewSource
Specify your view name in my case Images
Look at your view and note down the column headers, I have 4 columns with the names Topics, Size, Created and last a calculated column called Ext
Add four columns in your component
On each column add the Column number in the Excel sheet where the data should be placed and the name of the column.
In my case I ended up with this
And now to we need to add the name of the exportfile and the easiest thing to forget the sheet name where you want to place the export data, Sheet1 in my case.
Now you view export is a bit more advance and you can specify what to export and in what column.
I will continue the series and show you more about the power of POI for XPages, stay tuned.
2016 Update that I got from a developer Lisa Gerlich that you might run into
I was having problems exporting more than 1000 documents using the
poi4Xpages excel workbook widget. I ended up posting on OpenNTF and
got an answer.
There is a property under the datasource property called maxRow. It
defaults to 1000. You can set the value as high you dare.