Free Support Forum - aspose.com

HeadersFooters

Hello,

I’ve tried to set the headersfooters accordingly, but it never seems to kick in. Could it be because I am using a page break instead of a section new break? My code is as follows:



Document Builder mBuilder = new DocumentBuilder(dstDoc);
mBuilder.InsertBreak(BreakType.SectionBreakNewPage);
dstDoc.Sections[dstDoc.Sections.Count - 1].HeadersFooters.LinkToPrevious(HeaderFooterType.HeaderPrimary, false);



Yet when I look in the resulting word documents, all the headers are linked. Am I missing something obvious? Also I noticed when I do a PAGE break (not a section break) then the dstDoc.Sections.Count does not increment. Is there another way to handle this? If I do page breaks, the page numbering is fine. If I do section breaks, then each page starts at 1 again (I have two sets of page numbering, one for TOC and one for the main page). Attached is the template I work with. There is a “letter tab” on the side (A, B, C, etc) that shows up as an image in the header on only odd number pages, so I had to set odd and even headers. Your assistance is greatly appreciated. Thank you.


In the Word document HeadersFooters are property of the section, not of the page.

Page breaks do not create new sections.

Concerning your other questions please specify what do you want to achieve and what difficulties do you have.