SetSpacingLine
Sets the paragraph line spacing.
If the value of the sLineRule parameter is either "atLeast" or "exact", then the value of nLine will be interpreted as twentieths of a point. If the value of the sLineRule parameter is "auto", then the value of the nLine parameter will be interpreted as 240ths of a line.
Inherited from ApiParaPr.SetSpacingLine.
Syntax
expression.SetSpacingLine(nLine, sLineRule);
expression - A variable that represents an ApiParagraph class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| nLine | Required | twips | line240 | The line spacing value measured either in twentieths of a point (1/1440 of an inch) or in 240ths of a line. | |
| sLineRule | Required | "auto" | "atLeast" | "exact" | The rule that determines the measuring units of the line spacing. |
Returns
boolean
Example
Control the vertical distance between lines of text in a paragraph in a spreadsheet.
// How do I make a paragraph double-spaced or set an exact line height in a spreadsheet?
// Adjust how tightly or loosely lines are stacked within a paragraph inside a shape in a spreadsheet.
let worksheet = Api.GetActiveSheet();
let fill = Api.CreateSolidFill(Api.RGB(255, 111, 61));
let stroke = Api.CreateStroke(0, Api.CreateNoFill());
let shape = worksheet.AddShape("flowChartOnlineStorage", 120 * 36000, 70 * 36000, fill, stroke, 0, 2 * 36000, 0, 3 * 36000);
let content = shape.GetContent();
let paragraph = content.GetElement(0);
paragraph.SetSpacingLine(2 * 240, "auto");
paragraph.AddText("Paragraph 1. Spacing: 2 times of a common paragraph line spacing.");
paragraph.AddLineBreak();
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph = Api.CreateParagraph();
paragraph.SetSpacingLine(200, "exact");
paragraph.AddText("Paragraph 2. Spacing: exact 10 points.");
paragraph.AddLineBreak();
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
paragraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
content.Push(paragraph);