Free Support Forum -

Identifying footers section


I am using Aspose Words for Java. I have a document with two sections having content in second section’s footer.I am trying to take the footer using the code

NodeCollection headFootNodes = doc.getChildNodes(NodeType.HEADER_FOOTER, true);
for (int hfCount = 0; hfCount < headFootNodes.getCount(); hfCount++) {
HeaderFooter headFoot = (HeaderFooter) headFootNodes.get(hfCount);
if (headFoot.getStoryType() == StoryType.PRIMARY_FOOTER ) {

How to identify that footer belongs to second section rather than taking getParentSection()? Please assist me.


Thanks for your question and interest in Aspose.

Your question is related to Aspose.Words, so I am moving your thread to Aspose.Words forum.


Thanks for your request. I think in your case, you can look through all section and then loop through all HeaderFooter nodes of this section. In this case you will know exactly which section the HeaderFooter belongs to.

// Open document.

Document doc = new Document("in.doc");

// Loop through section in the document.

for(Section sect : doc.getSections())


// Loop through HeaderFooter nodes in the section.

for(HeaderFooter hf : sect.getHeadersFooters())


// Do something.



Best regards,