border_surrounds_header property
PageSetup.border_surrounds_header property
Specifies whether the page border includes or excludes the header.
@property
def border_surrounds_header(self) -> bool:
...
@border_surrounds_header.setter
def border_surrounds_header(self, value: bool):
...
Remarks
Note, changing this property affects all sections in the document.
Examples
Shows how to apply a border to the page and header/footer.
doc = aw.Document()
builder = aw.DocumentBuilder(doc=doc)
builder.writeln('Hello world! This is the main body text.')
builder.move_to_header_footer(aw.HeaderFooterType.HEADER_PRIMARY)
builder.write('This is the header.')
builder.move_to_header_footer(aw.HeaderFooterType.FOOTER_PRIMARY)
builder.write('This is the footer.')
builder.move_to_document_end()
# Insert a blue double-line border.
page_setup = doc.sections[0].page_setup
page_setup.borders.line_style = aw.LineStyle.DOUBLE
page_setup.borders.color = aspose.pydrawing.Color.blue
# A section's PageSetup object has "BorderSurroundsHeader" and "BorderSurroundsFooter" flags that determine
# whether a page border surrounds the main body text, also includes the header or footer, respectively.
# Set the "BorderSurroundsHeader" flag to "true" to surround the header with our border,
# and then set the "BorderSurroundsFooter" flag to leave the footer outside of the border.
page_setup.border_surrounds_header = True
page_setup.border_surrounds_footer = False
doc.save(file_name=ARTIFACTS_DIR + 'PageSetup.PageBorder.docx')
See Also
- module aspose.words
- class PageSetup