I have been trying to group sections of my document into "clumps", so I can re-order the document at runtime depending on user grouping (for mail merge).
I initially tried to use bookmarks, because of the bookmark navigator and the ability to select a bunch of the document as a bookmark, but this approach has been dropped as bookmark contents cannot contain section breaks.
Now I'm looking at using comments to select the regions of the document as the comments can include section breaks. Basically, I require regions in my document that match the names of my data tables in my data set pre mail merge. I can name the regions with the comments just fine, so I can find them, but I don't seem to be able to get the actually contents of the document that the comments surround so that I can build a new document in my order from the commented sections.
Is this not possible? Is there another way to achieve what I'm trying to do that is simpler?
Any help here would be greatly appreciated.
Thank for your interest in Syncfusion products.
If your requirement is to copy the sections of the source document to the destination document, then it is not necessary to use the Bookmark navigator and comments. You can directly iterate the sections of the source document, clone the sections and add that in the destination document. Kindly use the below code to clone the sections.
WordDocument source = new WordDocument("SourceFile.docx");
WordDocument destination = new WordDocument();
foreach (WSection section in document.Sections)
Please refer the below UG documentation link to know more about clone and merge.
You can also reorder the sections based on the index while adding the sections to the destination document.
Please let us know if you have any other questions.
Thank you for your update.
You could use the same syntax for the table and column names with spaces, you don’t need to use t-sql syntax at all.
Ex: My Column Name = %Table 2 Name.My Column Name%
For your reference we have prepared the sample with the Dataset contains DataTable with space in table and column names and which is used during the mail merge process. For your reference we have attached sample for the same.
Please let us know if you have any questions.