Reporting - Export Report Groups To Separate Excel Sheets

Reporting Team Blog
11 July 2019

To specify how a document is exported to Excel, our reporting tools provide the property XlsxExportOptions.ExportMode. Here are the three possible values of that property:

Name Description
SingleFile The document is exported to a single file. In this mode, page headers and footers are added to the resulting XLSX file just once, at the beginning and the end of the document.
DifferentFiles The document is exported to multiple files, one report page per file.
SingleFilePageByPage The document is exported to a single file, but an individual sheet is created for each page.

As you can see, if the report document is split into parts during the export process, this always happens along page boundaries. If you wanted to split the report into individual files or sheets per group instead of page, the only solution in the past was to use the Spreadsheet Document API from the Office File API product suite as described in the article How to export reports to different sheets in an XLSX file by using Spreadsheet Document Server.

In v19.1.4 we made this possible without any additional components. Read on to find out the details.

The RollPaper Property

The name of this property might sound old-fashioned, but it can be used to solve the problem described above. In v19.1.4 we fixed an issue for this feature, so that page breaks are now recognized correctly when RollPaper is true.

Here is a report with one group level:

Report with Group Level

The following image shows the same report with a group footer band inserted. The height of the band is zero and its PageBreak property is set to AfterBand:

Report with Group Footer and PageBreak

The property XtraReport.RollPaper has now been enabled. In the Preview tab you see a document with several pages of different lengths. Each page represents one group.

Report Preview

When this report is exported to Excel using the export mode SingleFilePageByPage, each report group occupies its own sheet in the resulting file:

Export to Excel

Your Feedback Counts

We are interested in your thoughts about the suggested solution described in this post. For the future, we will consider a special export mode SingleFileGroupPerPage. Using this mode, the preview could show “normal” page sizes, while the export would still create the same result you see above. Please submit your responses to this short survey to let us know your priorities:

2 comment(s)
Gosha
Gosha
Very good addition!
11 July, 2019
Customer45595
Customer45595
I like it
11 October, 2019

Please login or register to post comments.