Free Support Forum -

Troubles with HeadersFootersLinkToPrevious (116.5 KB)

Please look at the attached document.
If I open it with Word, I can see 4 sections

  • Footers for section 1 and 2 are linked
  • Footers for section 3 and 4 are linked

If I open the document with Aspose.Words, section 4 has no footers anyway.
When I add content from another file (using doc.AppendDocument), all new appended sections do not have the desired footers, even if I call LinkToPrevious(true), using code like this
BTW, the document to be appended have just one section, so doc.LastSection refers to the new section appended from the other document)

Or is the shape in the footer the problem? As it looks like the pagenumber field is actually present in the footer of the appended section… :thinking:
Any hints?


Aspose.Words mimics the behavior of MS Word.

Please open the document to be appended with MS Word 2016. Press Ctrl+A and then Ctrl+C keys to copy all content in this document (do not close this MS Word window yet).

Now, please open your “20180521232139820.docx” document with another instance of MS Word 2016. Press Ctrl+End key to move cursor to the end of document. Go to Layout tab, then Break, then choose Section Breaks (Next Page). Press Ctrl+V to paste the copied document. MS Word 2016 will also not show footer content for the appended document.

Maybe instead of linking Headers/Footers of section 3 to 4, you should copy whole Headers/Footers from section 3 to section 4.

Agree that this is the same behavior as Word, my understanding was that calling LinkToPrevious(true) would solve the problem, i.e. headers would be replicated from the previous section to the newly added one… If not, what’s the meaning of that method?


The HeaderFooterCollection.LinkToPrevious Method (Boolean) just links or unlinks all headers and footers to the corresponding headers and footers in the previous section. However, it does not physically create/copy those headers and footers from previous section to next section. In your case, you should try manually copying whole headers and footers from section 3 to section 4. Hope, this helps.


I’ve finally found the problem… Footer was there, but it was not visible as PageSetup.FooterDistance was different than the expected value (i.e. the value set in the previous section).
Once I fixed the value, everything was as expected


It is great you were able to find what you were looking for. Please let us know any time you have any further queries.