.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ParagraphPropertiesBase.LineSpacing Property

Gets or sets a line spacing value.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v21.2.Core.dll


float? LineSpacing { get; set; }

Property Value

Type Description

A Single value representing line spacing measured in Document.Unit units or null (Nothing in Visual Basic) for a mixture of paragraphs with different line spacings.


The LineSpacing property is used when the ParagraphPropertiesBase.LineSpacingType property is set to either the ParagraphLineSpacing.Exactly or ParagraphLineSpacing.AtLeast value.

Use the SubDocument.BeginUpdateParagraphs and the SubDocument.EndUpdateParagraphs paired methods to modify paragraph formatting, such as the ParagraphPropertiesBase.LineSpacing, Paragraph.Alignment, Paragraph.SpacingBefore etc.

Call the SubDocument.BeginUpdateParagraphs method for the specified range, modify the properties of the returned ParagraphProperties object and call the SubDocument.EndUpdateParagraphs method to finalize the modification.

The following code snippet changes the first line indent and the line spacing of the paragraph containing the selection. It also adds a new tab stop for the paragraph using the Paragraph.BeginUpdateTabs - Paragraph.EndUpdateTabs pair of methods.

document.AppendText("Modified Paragraph\nNormal\nNormal");

//The target range is the first paragraph
DocumentPosition pos = document.Range.Start;
DocumentRange range = document.CreateRange(pos, 0);

// Create and customize an object  
// that sets character formatting for the selected range
ParagraphProperties pp = document.BeginUpdateParagraphs(range);
// Center paragraph
pp.Alignment = ParagraphAlignment.Center;
// Set triple spacing
pp.LineSpacingType = ParagraphLineSpacing.Multiple;
pp.LineSpacingMultiplier = 3;
// Set left indent at 0.5".
// Default unit is 1/300 of an inch (a document unit).
pp.LeftIndent = DevExpress.Office.Utils.Units.InchesToDocumentsF(0.5f);
// Set tab stop at 1.5"
TabInfoCollection tbiColl = pp.BeginUpdateTabs(true);
TabInfo tbi = new DevExpress.XtraRichEdit.API.Native.TabInfo();
tbi.Alignment = TabAlignmentType.Center;
tbi.Position = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5f);

//Finalize modifications
// with this method call
See Also