跳到主要内容

SetSpacing

设置以二十分之一磅为单位测量的文本间距。

语法

expression.SetSpacing(nSpacing);

expression - 表示 ApiRange 类的变量。

参数

名称必需/可选数据类型默认值描述
nSpacing必需twips以二十分之一磅(1/1440 英寸)为单位测量的文本间距值。

返回值

ApiRange | null

示例

调整文档中选定文本范围内的字符间距。

// How do I spread out or tighten the letters within a highlighted portion of text in a document?

// Control the gap between individual characters to improve readability or achieve a design effect in a document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("ONLYOFFICE Document Builder");
let range = doc.GetRange(0, 24);
range.SetSpacing(2);