Hi Team,
Could you provide a example code (java code) where header/footer is included/excluded within the page border using surround header/footer API (like below) from Aspose.
pageSetup.setBorderSurroundsHeader(true/false);
pageSetup.setBorderSurroundsFooter(true/false);
Thanks,
Kumar
Hi Team,
I managed to find an example. Correct if it’s incorrect.
private static void headerFooter(DocumentBuilder builder) throws Exception {
Section currentSection = builder.getCurrentSection();
PageSetup pageSetup = currentSection.getPageSetup();
pageSetup.setDifferentFirstPageHeaderFooter(true);
pageSetup.setBorderDistanceFrom(PageBorderDistanceFrom.TEXT);
pageSetup.setBorderSurroundsHeader(true);
pageSetup.setBorderSurroundsFooter(false);
pageSetup.getBorders().setLineStyle(1);
// — Create header for the first page. —
pageSetup.setHeaderDistance(20);
builder.moveToHeaderFooter(HeaderFooterType.HEADER_FIRST);
builder.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);
builder.write(“Aspose.Words Header/Footer Creation Primer - Title Page.”);
builder.moveToDocumentStart();
builder.write(“Normal text in the body”);
}
Thanks,
Kumar
Hi Kumar,