Making you report look a bit nicer with some formatting.
Excel reporting from views can be so dull and boring the XPages for POI can give you more options in this matter and help you create some design to your report.
1. Customizing your template
Because POI is using a copy of you template you can customize your temple with logos and predefined information.
We need to import this new template and change the startRow and template name
In this case we start at row 12 below the logo and we assign the new template with the logo that we created. Note that the data will be placed on the row below the one you specified, don’t know why but good to know.
And the Export will be a combined with the logo from the template and the data from the Domino view.
But we want more
2. Setting up a header for you data
This can be done in two ways 1 directly in your template but that isn’t good in if you want to add a column that you need to change the template or if you want to use the template for multiple exports.
So what we do is that we add columns to our Export above the data, we need 4 columns for this example.
We click on add on cellValues and add 4 items of cellValue and as you can see we could also add data to Excel bookmarks. Could be handy if you have a multi sheet excel file.
We specify the columnNumber, rowNumber and because we know the header value we write it but we could actually compute the value also. But a header in plain text is quite dull so we click on cellStyle, scroll down and set the property to get bold on the font and a bigger size.
Your Excel export with a custom logo and a styled header is now ready. There is lots of stuff to cover with POI and application integration so this series will continue, the more I dig into POI for XPages the more I love it.
Part 1: http://www.xpagedeveloper.com/2015/if-your-user-want-reports-in-excel-you-should-read-this
Part 2: http://www.xpagedeveloper.com/2015/moving-on-with-excel-export-part-2