This will take some time, the issue is deep in a very large application. While I am working on that, I will try to rephrase my question and make it more clear:
Here is a rough pseudo code of what I am doing:
var d = new Document();
loop over all “blocks” I want to add
for each block:
var newDoc = new Document (using a template file that is selected from a number of types)
Now, the template files have alternating odd/even headers and footers.
If the mailmerge generates a newDoc that is more than one page, this looks fine with page numbers alternating to the left/right.
But here is the problem: Each first page from a new AppendDocument operation always starts to the right!
Which means that if I append a lot of one page documents, every page is a “right” page.
I have tried the following to no avail:
- Setting d.FirstSection.PageSetup.OddAndEvenPagesHeaderFooter = true on the base document.
- Executing d.UpdatePageLayout(); after appending
- Executing newDoc.FirstSection.HeadersFooters.LinkToPrevious(true); on each new document
I will try to make a standalone demo of this, but if you have any ideas already, it would be greatly appreciated!