Enable Link to Previous Navigation Option to Continue using Same Headers Footers in Word Document using Java API

Hi, I have researched many reports of issues with this subject but none totally answer my question.
I have a simple test doc x that has a header/footer set on the first page followed by a section break where I set a new header/footer.

My understanding was that I can cycle sections and retrieve the heads & Feet in operation within each section but so far I get all heads & feet for the document at section 1 and none from section 2?

Can you help to understand what I am doing wrong?

Test Code segment:-
Iterator sectIter = this.ourAsposeInterface.getSections();
int sectNo = 1;
while (sectIter.hasNext()) {
Section aSection = sectIter.next();
System.out.println(“Section:” + sectNo);
System.out.println("Section has : " + + aSection.getHeadersFooters().getCount() + “Head/Feet”);
Iterator hfIter = aSection.getHeadersFooters().iterator();
int hf = 1;
while ( hfIter.hasNext() ) {
HeaderFooter anHF = hfIter.next();
System.out.println("Item: " + hf + " is " + HeaderFooterType.getName(anHF.getHeaderFooterType()) + “/” + anHF.getText());
hf++;
}
sectNo++;
}

output print:
Section:1
Section has : 5Head/Feet
Item: 1 is HEADER_EVEN/

Item: 2 is HEADER_PRIMARY/Opening header keyed at page 2 start

Item: 3 is FOOTER_PRIMARY/Opening footer keyed at page 2 start

Item: 4 is HEADER_FIRST/Opening One-Off header keyed at page 1 start

Item: 5 is FOOTER_FIRST/Opening One-Off footer keyed at page 1 start

Section:2
Section has : 0Head/Feet

I have added the docx file.

Appreciate your help

Thanks
Jan
word2016_headersfooters_page1_continuous.zip (17.9 KB)

@JanUrbanski,

Your document contains two Sections and only first Section has headers and footers. The second Section does not have any headers footers. You are seeing them in MS Word because ‘Link to Previous’ option is enabled. For both header and footer in Section 2, if you disable ‘Link to Previous’ option and Save As to a new DOCX file, MS Word will then copy Primary header/footer from previous section to this Section. Hope, this helps.

Link to Previous Header Footer Section

Hi,
Thanks - Afraid Word has me in tatters on how to make it work as expected.
I can see this now.

Appreciate your help

Jan

@JanUrbanski,

Thanks for your feedback. In case you may have further inquiries or need any help in future, please let us know.