Hi,
I’m seeing the behavior when I save the single paged document while cursor being present in default header (different first, odd and even page headers footers flag disabled).
When detecting headers and footers for the same document Aspose is reporting all 6 different headers and footers are present.
Please see the attached image for reproducing the same scenario. Also attaching such doc in which only default (primary) header footer are present but Aspose reports all 6 are present.
Document doc1 = new Document(“specialDoc.docx”);
System.out.println(doc1.getFirstSection().getHeadersFooters().getCount());
int count = doc1.getFirstSection().getHeadersFooters().getCount();
for(int i = 0; i < count; i++) { System.out.println(doc1.getFirstSection().getHeadersFooters().get(i).getHeaderFooterType());
System.out.println(doc1.getFirstSection().getHeadersFooters().get(i).getText());
}
Hi Praneeth,
Thanks for your inquiry. HeaderFooter class represents a container for the header or footer text of a section. HeaderFooter is a section-level node and can only be a child of Section. There can only be one HeaderFooter or each HeaderFooterType in a Section. You can add and remove HeaderFooter from a section.
If Section does not have a HeaderFooter of a specific type or the HeaderFooter has no child nodes, this header/footer is considered linked to the header/footer of the same type of the previous section in Microsoft Word. When HeaderFooter contains at least one Paragraph, it is no longer considered linked to previous in Microsoft Word.
PraneethS:
I’m seeing the behavior when I save the single paged document while cursor being present in default header (different first, odd and even page headers footers flag disabled).
The case is I don’t want any header and footer other than the primary in the section in this particular case and don’t want to enable other headers and footers. The question is why they (different {first, even, odd} page X{header, footer}) got created when I save in the way mentioned in my last post in the thread.
Is this a bug?
Hi Praneeth,
Thanks for your inquiry.
PraneethS:
When detecting headers and footers for the same document Aspose is reporting all 6 different headers and footers are present.Please see the attached image for reproducing the same scenario. Also attaching such doc in which only default (primary) header footer are present but Aspose reports all 6 are present.
PraneethS:
I don’t want to enable other headers and footers. The question is why they (different {first, even, odd} page X{header, footer}) got created when I save in the way mentioned in my last post in the thread.Document doc1 = new Document(“specialDoc.docx”);System.out.println(doc1.getFirstSection().getHeadersFooters().getCount());int count = doc1.getFirstSection().getHeadersFooters().getCount();for(int i = 0; i < count; i++) { System.out.println(doc1.getFirstSection().getHeadersFooters().get(i).getHeaderFooterType());System.out.println(doc1.getFirstSection().getHeadersFooters().get(i).getText());}