• Post category:ApiParagraph
  • Запись изменена:12.11.2022

SetSpacingLine(nLine, sLineRule)

Унаследованный от: ApiParaPr#SetSpacingLine

Устанавливает межстрочный интервал абзаца. Если значение параметра sLineRule равно «atLeast» или «exact», то значение nLine будет интерпретироваться как двадцатые доли точки. Если значение параметра sLineRule равно «auto», то значение параметра nLine будет интерпретироваться как 240-е строки

Параметры:

НазваниеТипОписание
nLinetwips | line240Межстрочный интервал измеряется либо в двадцатых долях точки (1/1440 дюйма), либо в 240-х долях строки.
sLineRule«auto» | «atLeast» | «exact»Правило, определяющее единицы измерения межстрочного интервала.

Возвращает:

Этот метод не возвращает никаких данных.

Пример

builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.SetSpacingLine(3 * 240, "auto");
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.SetSpacingLine(200, "exact");
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.SetSpacingLine(400, "atLeast");
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);
builder.SaveFile("docx", "SetSpacingLine.docx");
builder.CloseFile();