The issue you are facing seems related to the method you are using in order to create DocumentFragment
. Basically, the two approaches shown in my previous post differ in the way the properties of the sections are copied when creating the document fragment instance. The first approach - using the selection, copies all properties of the sections and the page/section breaks are one of them, as opposed to the second approach (which is also the one used in your snippet).
So, in order to make your project work as per your requirments
I suggest you create the DocumentFragments using the other approach - through selection.
DocumentFragment fragment = mergedDocument.Selection.CopySelectedDocumentElements();
I am also attaching the project I used for testing for your reference.
When it comes to your remark that if you do not set the LayoutMode of the document to Paged, the result is a single page, this is due to the fact that the default LayoutMode
is Flow. If you want to ensure that the document would be in paged mode, you should keep the property as it is.
As for a pages collection of some sort, RadDocument's element hierarchy
does not contain the concept of pages. Pages are simply a representative manner and depend on the layout mode. However, in the way that the project attached is implemented, the separate mail-merge entries are actually Sections
, so if you need to access them, you can do so through the appropriate API.
I hope this information is helpful! Let us know if you are experiencing other problems.