We have a project that uses the MailMerge method to automatically generate documents, based on templates and information we get from our database.
Recently we added some code from here, which we use to divide the generated documents in pages, and then check if there are empty pages so that we can remove those.
But we are now facing an issue where when the template has a page that ends with a sectionbreak, a new page will be created after it that starts with a section break, which results in an empty page.
Example template: image.png (5.8 KB)
Results in: image.png (7.4 KB)
So my question, is there a way to add a new section to a document, after a page that ends in a section without the empty page in between.