SetSpacingLine

function SetSpacingLine(nLine: twips | line240 = null, sLineRule: auto | atLeast | exact = null): void

Description

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.

Parameters

nLinetwips | line240default: null

The line spacing value measured either in twentieths of a point (1/1440 of an inch) or in 240ths of a line.

sLineRuleauto | atLeast | exactdefault: null

The rule that determines the measuring units of the line spacing.

Returns

void

Try It

var oDocument = Api.GetDocument();
var oMyStyle1 = oDocument.CreateStyle("My document style #1");
var oParaPr = oMyStyle1.GetParaPr();
oParaPr.SetSpacingLine(3 * 240, "auto");
var oMyStyle2 = oDocument.CreateStyle("My document style #2");
oParaPr = oMyStyle2.GetParaPr();
oParaPr.SetSpacingLine(200, "exact");
var oMyStyle3 = oDocument.CreateStyle("My document style #3");
oParaPr = oMyStyle3.GetParaPr();
oParaPr.SetSpacingLine(400, "atLeast");
var oParagraph = oDocument.GetElement(0);
oParagraph.SetStyle(oMyStyle1);
oParagraph.AddText("Paragraph 1. Spacing: 3 times of a common paragraph line spacing.");
oParagraph.AddLineBreak();
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes.");
oParagraph = Api.CreateParagraph();
oParagraph.SetStyle(oMyStyle2);
oParagraph.AddText("Paragraph 2. Spacing: exact 10 points.");
oParagraph.AddLineBreak();
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes.");
oDocument.Push(oParagraph);
oParagraph = Api.CreateParagraph();
oParagraph.SetStyle(oMyStyle3);
oParagraph.AddText("Paragraph 3. Spacing: atLeast 20 points.");
oParagraph.AddLineBreak();
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes. ");
oParagraph.AddText("These sentences are used to add lines for demonstrative purposes.");
oDocument.Push(oParagraph);

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).