Skip to main content

SetSpacing

Sets the text spacing measured in twentieths of a point.

Syntax​

expression.SetSpacing(spacing);

expression - A variable that represents an ApiParagraph class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
spacingRequiredtwips | nullThe value of the text spacing measured in twentieths of a point (1/1440 of an inch). Pass null to remove the text spacing.

Returns​

ApiParagraph

Example​

Set the character spacing for text in a paragraph in a document.

// How do I control the amount of space between characters in a paragraph in a document?

// Expand or compress the gaps between letters within a paragraph in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("This is just a sample paragraph.");
paragraph.SetSpacing(2);