Skip to main content

SetDistanceFromText

Sets the distance between the drop cap and the paragraph text measured in twentieths of a point (1/1440 of an inch).

Syntax​

expression.SetDistanceFromText(distance);

expression - A variable that represents an ApiDropCap class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
distanceRequiredtwipsThe distance between the drop cap and the paragraph text. Must be a non-negative number.

Returns​

ApiDropCap

Example​

Set the distance between a drop cap and the paragraph text in a document.

// 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);