Skip to main content

SetTopBorder

Specifies the border which will be displayed above a set of paragraphs which have the same set of paragraph border settings. 💡 The paragraphs of the same style going one by one are considered as a single block, so the border is added to the whole block rather than to every paragraph in this block.

Syntax

expression.SetTopBorder(sType, nSize, nSpace, r, g, b);

expression - A variable that represents a ApiParagraph class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sTypeRequiredBorderTypeThe border style.
nSizeRequiredpt_8The width of the current top border measured in eighths of a point.
nSpaceRequiredptThe spacing offset above the paragraph measured in points used to place this border.
rRequiredbyteRed color component value.
gRequiredbyteGreen color component value.
bRequiredbyteBlue color component value.

Returns

boolean

Example

This example specifies the border which will be displayed above a set of paragraphs which have the same set of paragraph border settings.

// Set top border to the paragraph.

// Border with single line the text.

let doc = Api.GetDocument();
let myStyle = doc.CreateStyle("My document style");
let paraPr = myStyle.GetParaPr();
paraPr.SetTopBorder("single", 24, 0, 255, 111, 61);
let paragraph = doc.GetElement(0);
paragraph.SetStyle(myStyle);
paragraph.AddText("This is the first paragraph. ");
paragraph.AddText("The paragraph properties styled above set a border above it.");