PageSetupBorderSurroundsHeader Property

Specifies whether the page border includes or excludes the header.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0

ExpandedSyntax

public bool BorderSurroundsHeader { get; set; }

Property Value

Type: Boolean

ExpandedRemarks

Note, changing this property affects all sections in the document.

ExpandedExamples

Shows how to apply a border to the page and header/footer.
Document doc = new Document();

// Insert header and footer text
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
builder.Write("Header");
builder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
builder.Write("Footer");
builder.MoveToDocumentEnd();

// Insert a page border and set the color and line style
PageSetup pageSetup = doc.Sections[0].PageSetup;
pageSetup.Borders.LineStyle = LineStyle.Double;
pageSetup.Borders.Color = Color.Blue;

// By default, page borders do not surround headers and footers
// We can change that by setting these flags
pageSetup.BorderSurroundsFooter = true;
pageSetup.BorderSurroundsHeader = true;

doc.Save(ArtifactsDir + "PageSetup.PageBorder.docx");

ExpandedSee Also