跳到主要内容

SetUnderline

指定此段落的内容显示时在字符正下方有一条线 (小于行中字符上下的所有间距)。

语法

expression.SetUnderline(isUnderline);

expression - 表示 ApiParagraph 类的变量。

参数

名称必需/可选数据类型默认值描述
isUnderline必需boolean指定当前段落的内容显示为带下划线。

返回值

ApiParagraph

示例

此示例展示如何对形状内段落中的所有文本应用下划线格式。

const worksheet = Api.GetActiveSheet();
const fill = Api.CreateSolidFill(Api.RGB(100, 140, 140));
const stroke = Api.CreateStroke(0, Api.CreateNoFill());
const shape = worksheet.AddShape(
'roundRect',
Api.MillimetersToEmus(70), Api.MillimetersToEmus(30),
fill, stroke,
0, 0, 2, 0
);

const content = shape.GetContent();
const paragraph = content.GetElement(0);
paragraph.AddText('This text is underlined.');
paragraph.SetUnderline(true);

const paragraph2 = Api.CreateParagraph();
paragraph2.AddText('This text is not underlined.');
content.Push(paragraph2);