While create documents using “LinkToPrevious” methods, it adds 6 footer/header automatically. Please check the below for further reference.
1) Create a word document using .Net aspose dll
Document wordDoc = new Document();
2) Create a section
wordDoc.Sections.Clear();
Section currentSection = new Section(wordDoc);
wordDoc.Sections.Add(currentSection);
3) Just set LinkToPrevious to false
currentSection.HeadersFooters.LinkToPrevious(false);
4) Just check the count for “currentSection.HeadersFooters” its 6, how???
Please let me know for further reference.
Hi Sridhar,
Regarding WORDSNET-13245, our product team has completed the work on your issue and has come to a conclusion that this issue and the undesired behavior you're observing is actually not a bug. So, we will close this issue as 'Not a Bug'.
The HeaderFooterCollection.LinkToPrevious method links or unlinks all headers and footers to the corresponding headers and footers in the previous section. If any of the headers or footers do not exist, it creates them automatically. So this is the expected behavior.
So after calling this method you will get 6 headers/footers:
- HeaderFooterType.HeaderPrimary,
- HeaderFooterType.HeaderFirst,
- HeaderFooterType.HeaderEven,
- HeaderFooterType.FooterPrimary,
- HeaderFooterType.FooterFirst,
- HeaderFooterType.FooterEven.
Best regards,