How to export a view to excel with POI4XPAGES
After you created an Excel Template, added it as dataSource and configured the export properties we now going to export a view.
Our export view looks like this. Keep the column titles in mind, as we are going to use them for the column definition for our export:
To export a view a exportDefinition has to be added:
We can choose between data2rowexport and data2columnexport which represents the export direction.· startRow: 0 based. Defines the row where the export should start
· stepSize: 1 or higher. It’s possible to export a dataset to 1, 2 or more rows. (see columns for how to assign an other row)
Assign the dataSource:
· database: define the database which has to be used, empty means the current database
· key: works like getAllDocumentsByKey
· maxRow: the maximum (currently 1’500 entries) of entries to export
· search: a fulltext search query
· viewName: the name of the view to export
Assign the columns:
Each column needs a columnDefinition.
· columnNumber: the number of the column (0 based)
· columnTitle: the title of the column from the view defined as dataSource
· rowShift: this defines how many rows down the value should be shifted (multiple row export per dataset)
The export works with the same button we created for the Configuration export.