Hi!
The mystery is solved:
For section one you set the starting number, maybe like this:
Code:
var sec1 = document.LastSection;
sec1.PageSetup = document.DefaultPageSetup.Clone();
sec1.PageSetup.StartingNumber = 17;
For section two you have to assign the PageSetup, but do not set the starting number. Maybe like this:
Code:
var sec2 = document.AddSection();
sec2.PageSetup = document.DefaultPageSetup.Clone();
If you do not set a PageSetup for the second section, then it will inherit the PageSetup from the first section - and it will have the same starting number.
If you set a PageSetup without a starting number for the second section, then everything will be fine and page numbering for section two continues as expected.
A third section would inherit the page setup from the second section, so there is no need to set the page setup.
And with my test, the second section inherited the footer from the first section. So there is no need to duplicate the code that sets header and footer, just set a clean page setup for the second section.
I am sorry that it took me so long to come up with this rather simple solution.
So it is no bug, it's a feature.