get(HeaderFooterType.HEADER_PRIMARY) returns a FOOTER_PRIMARY


#1

In the Java version getting a HEADER_PRIMARY actually returns a FOOTER_PRIMARY:



HeaderFooter
sampleHeaderPrimary =
builder.getCurrentSection().getHeadersFooters().get(HeaderFooterType.HEADER_PRIMARY);



if(sampleHeaderPrimary.getHeaderFooterType() != HeaderFooterType.HEADER_PRIMARY)

System.err.println(“Sample header primary does not have header primary
type!” );

if(sampleHeaderPrimary.getHeaderFooterType() == HeaderFooterType.FOOTER_PRIMARY)

System.err.println(“Sample header primary has footer primary
type!” );



Both of these lines print.


#2

Thanks for reporting this problem. I have logged it to our defect base as issue #1198. We will fix it in the next release which will be published in a few weeks.

Best regards,


#3

ok, in the meantime is there some other way to access an existing header?

Thanks.



#4

I have just realized that there are actually two methods for retrieving HeaderFooter from HeaderFooters collection: get(int index) and getByHeaderFooterType(int headerFooterType).

You have used the first but should probably use the second. That way you will get the header/footer of the specified type correctly.

Best regards,


#5

That fixes the problem. Thanks!!