Free Support Forum - aspose.com

Header and footer

Hello Aspose team,

I have a question for you. Is there any way in code (Java) that text from doc file is marked as text from header or footer? If we get run from document, can we know if thet run contains text that is in header or footer?

I hope that you understand what I try to ask you.

Thanks
Branko

Hi

Thanks for your inquiry. I think in your case you can use node.getAncestor method. For example the following code checks if a run is in a header/footer.

Node parent = run.getAncestor(NodeType.HEADER_FOOTER);

if (parent != null)

System.out.print("Is In Header");

Hope this helps.

Best regards,