This example generates a Microsoft Word document that has solid, red, 0.5-point borders positioned 20 points from the page boundary.
Import the DOM API package so that you do not have to use long, fully qualified class names.
Create a Word document.
d = Document("myDocument","docx"); open(d);
PageBorder object and specify the border style, color, and width.
pageBorder = PageBorder("solid","red","0.5pt");
Specify that the border position is relative to the page boundary and specify the margin between the page boundary and the border.
pageBorder.MeasureFrom ="pageboundary"; pageBorder.Margin = "20pt";
PageBorder property of the layout associated with the document to the
d.CurrentPageLayout.PageBorder = pageBorder;
Add text to the document. Close and view the document.
append(d,"The solid, red, 0.5-point border is 20 points from the page boundary."); close(d); rptview(d);