I’m trying to change the page size of Word documents and have the corresponding content reflow. Most recently I’ve tried the following code:
var document = new WordDocument(pathToDoc);
foreach (var section in document.Sections.Cast<Section>())
{
section.PageSetup.PageHeight = newHeight;
}
Unfortunately, when shrinking the page height of the sections, the document isn’t reflowing correctly and the contents start to overlap and become unreadable. The curious thing I noticed is that for a document with 4 pages, there were 7 sections. I was under the impression that each page was a “section” of the document. Is that not correct? We’re trying to programmatically reduce the height of Word documents that are submitted to account for a header in the printout. Any help here would be greatly appreciated.