Free Support Forum -

Header / footer run off pages after merging sections of docs

I am having a problem where the header and footer are cut off on the right side of the document after I combine multiple documents into one document. When I view each document individually they look fine, but once they are combined the headers and footers are cut off. If I open the final document in Word and then edit the header/footer section (making no changes) then close it, everything pops back into place. I am using Aspose.Word 3.0 and my code to merge the documents is pasted below:

private Document CombineDocuments()

Document myPackageDoc = new Document();
Section mySection = myPackageDoc.Sections[0];

DataTable myDocList = GetDocumentList();

// GetDocumentList() is my own method that gets a list of document file names
// and puts them in a DataTable.

foreach (DataRow myDR in myDocList.Rows)
Document srcDoc = new Document((string)myDR["FileName"]);

for (int x=0; x < srcDoc.Sections.Count; x++)
Section mySourceSection = srcDoc.Sections[x];
Section newSection = (Section) myPackageDoc.ImportNode(mySourceSection, true);

return myPackageDoc;



Thank you for considering Aspose.

Please attach (probably pack if needed) the documents you are combining.

My original documents are attached in a .zip file. Let me know if you need anything else…


Thank you, we’ll try to fix this issue asap.

Testing on my current code base I do not see the “cut off” or “run off” effect you are talking about, maybe it has been fixed since the release, please wait until the next hotfix is out and try with it.

I’ve noticed another effect however. You documents, for example Doc1.doc has different headers and footers for the first, even and odd pages, but the produced document has different headers and footers only for the first page. This basically makes headers and footers look differently in the resulting document (maybe that’s what you call “run off”?).

This effect is caused by the fact that the “different first page header/footer” setting is per section in MS Word, but the “different odd and even pages header/footer” is a per document setting. It cannot easily be seen seen both settings are together in the Page Setup dialog box and they are both properties on the PageSetup object, but that’s the fact of life.

Since the “different odd and even pages header/footer” is per document and you are copying section nodes, this setting is not copied to the destination document of course. You should set different odd and even pages header/footer in the destination document manually I think.

Upgrading to Aspose.Word 3.0.3 seems to have solved the run-off problem.