PageSetupBorderDistanceFrom Property

Gets or sets a value that indicates whether the specified page border is measured from the edge of the page or from the text it surrounds.

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


public PageBorderDistanceFrom BorderDistanceFrom { get; set; }

Property Value

Type: PageBorderDistanceFrom


Shows how to create a page border that looks like a wide blue band at the top of the first page only.
Document doc = new Document();

PageSetup pageSetup = doc.Sections[0].PageSetup;
pageSetup.BorderAlwaysInFront = false;
pageSetup.BorderDistanceFrom = PageBorderDistanceFrom.PageEdge;
pageSetup.BorderAppliesTo = PageBorderAppliesTo.FirstPage;

Border border = pageSetup.Borders[BorderType.Top];
border.LineStyle = LineStyle.Single;
border.LineWidth = 30;
border.Color = Color.Blue;
border.DistanceFromText = 0;

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

ExpandedSee Also