MailMerge and Section break

When a merge region is spread over two section break, the mailmerge function raises an exception.

Do you plan to fix that?
In the meanwhile, do have have any hint to allow us to use the merge process with section breaks?
We need a global region that begins at the top of the document and ends with the doc. In the middle of the doc, we also have section break for formatting needs.

Regards,
Vincent

Dear Vincent,
Please note that during simple MailMerge the document content is repeated automatically for each data record in the data source. That means that if you have, for example, fields «Name», «Address» and «Zip» in your template document and you are merging with a data table that has columns named “Name”, “Address” and “Zip” and contains three rows of data, then the document will be merged with data from the first row, then duplicated, merged with second row and appended to the end of the resulting document and so on, for each data row. So in the end you will have have resulting document containing three copies of the initial template, each merged with the corresponding data row. See how it is done with MailingLabelsDemo.doc in our Aspose.Words.Demos.WinForms demo source code project for example.
Please let me know if that fits to your needs.
Best regards,

Vladimir,

Let’s say I have a section break (next page) between the field “Name” and the fields “Address” and “Zip” because the first page is in portrait orientation and the second one is in landscape orientation.

How can I achieve this result ?

Best Regards

You just need to call MailMerge.Execute with DataTable containing several data rows. The whole document content will be duplicated for each data row.
Best regards,

I use the MailMerge.ExecuteWithRegion function and I get an exception :

Mail merge region
‘LOOP1’ is badly formed. TableStart and TableEnd should be in the same
section, same table row or same table
cell

Best Regards,

As I have said in my previous post you need to call simple MailMerge.Execute and your merge fields should be without regions if you want an entire document content duplicated for each data row in a data source. I.e. MailMerge with regions should not be used in this case.
Best regards,