We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Reporting With Sub Headers

The basic problem I have here is that I have a list on people who are assigned to what is called a SITREP Category.

I want a report to show all the people in each SITREP category.

I can do this easily using ExecuteWithRegions with a column for SITREP Category and Columns for the person details.

With this way the SITREP Category is repeated for every person in that Category within the table.

Ideally, I want a sub header above the table that contains the SITREP Category and then a table below that with just the people in that Category. I would then need this to repeat for each SITREP Category that has people assigned to it, possibly each one on a new page. Is there a way to do this? I was trying to get my head round it for a while yesterday but couldn’t quite work it out.


Hi Joe,

The most natural solution to this is nested regions. Nested regions are not yet supported, but it is still possible to do what you want.

As this question about nested regions occurs again and again I will soon make a demo that shows how to work around the problem that nested regions are not yet supported.

Basically, if you cannot build your document using mail merge features because of this limitation, you still can use DocumentBuilder class. It just means you will be able to use less of MS Word to visually design your report and need to use a bit more programmatic effort to build your document, but it is certainly possible to build document of any complexity using DocumentBuilder.

As an extreme example, you can build entire report from empty document using DocumentBuilder. You can insert report title, create tables for topics and subtopics, create lists, specify font and paragraph formatting, basically anything. You will just enumerate through rows of your tables and invoke DocumentBuilder methods to build the content. This is a bit more programming than just using mail merge, but still can be done easily.

You can also try to combine using DocumentBuilder with mail merge and an interesting technique of copying sections of the document.

An example of combining mail merge with DocumentBuilder is that you use mail merge to build outer topics only and provide MailMerge.MergeField event handlers. Inside the handlers you invoke DocumentBuilder to create subtopic content.

Copying sections seems as a good technique and used by many customers. You can potentially separate your topic/subtopic table into a separate section inside the document using section breaks that do not start a new page. Then you can use Document.Sections collection to copy that section as many times as number of records you have in your data source. Then you can navigate to any cell in any table using DocumentBuilder.MoveToCell method to insert content of subtopics.

Thanks Roman

Any idea when you will be able to get a Demo done as I need this for the current application I am developing.

I will give it a go myself from what you’ve said but a demo would be a great help.


I will try to get the demo ready by Monday, 26th July.

No rush now, I sorted it easily after looking into the document builder, thanks.

Aspose.Word 2.1.3 is released with new demos, for more info see https://reference.aspose.com/words/net/aspose.words/documentbuilder and https://docs.aspose.com/words/net/mail-merge-and-reporting/.

The issues you have found earlier (filed as 39) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.