跳到主要内容

SetDistanceFromText

设置首字下沉与段落文本之间的距离,以二十分之一磅(1/1440 英寸)为单位。

语法​

expression.SetDistanceFromText(distance);

expression - 表示 ApiDropCap 类的变量。

参数​

名称必需/可选数据类型默认值描述
distance必需twips首字下沉与段落文本之间的距离。必须为非负数。

返回值​

ApiDropCap

示例​

设置文档中首字下沉与段落文本之间的距离。

// Add spacing between a drop cap and the surrounding paragraph text in a document.

// Increase the horizontal gap between the decorative initial letter and the paragraph text in a document.

const doc = Api.GetDocument();
const paragraph = Api.CreateParagraph();
paragraph.AddText('Once upon a time, there was a paragraph that started with a large decorative letter.');
doc.Push(paragraph);
const dropCap = paragraph.SetDropCap('drop');
dropCap.SetDistanceFromText(72);