Greetings -
I have an automated mail merge process that appends a series of Word documents together and then executes a mail merge. The problem I’m running into is that it appears that occaisonally one document will have significant white space on it’s last page, so that when the next document in the serries is appended, it doesn’t start on a new page. I need to be able to append these documents together but have each component document start on a new page.
Currently the code I’m using to append the documents is like this:
string currentPath = rootPath + component.ComponentPath;
Trace.WriteLine(string.Format("[CreateClaimsDocument]: Current template path is {0}", currentPath));
Aspose.Words.Document currentDocument = new Aspose.Words.Document(currentPath);
for (int i = 0; i < currentDocument.Sections.Count; i++)
{
Aspose.Words.Section newSection = (Aspose.Words.Section)wordDocument.ImportNode(currentDocument.Sections[i], true);
wordDocument.Sections.Add(newSection);
}
I’ve tried a few different things using DocumentBuilder.InsertBreak but that seems to always result in blank pages in the combined document.
Any suggestions on how I can append all these documents together and preserve the page breaks would be greatly appreciated.
Thanks,
Chris