How to: Change Formatting of the Current Paragraph
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-change-character-and-paragraph-formatting-e3323.
Imports System.Windows
Imports System.Drawing
Imports DevExpress.XtraRichEdit
Imports DevExpress.Office.Utils
Imports DevExpress.XtraRichEdit.API.Native
Dim doc As Document = richEditControl1.Document
Dim range As DocumentRange = doc.Selection
Dim pp As ParagraphProperties = doc.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 = Units.InchesToDocumentsF(0.5f)
' Set tab stop at 1.5"
Dim tbiColl As TabInfoCollection = pp.BeginUpdateTabs(True)
Dim tbi As New DevExpress.XtraRichEdit.API.Native.TabInfo()
tbi.Alignment = TabAlignmentType.Center
tbi.Position = Units.InchesToDocumentsF(1.5f)
tbiColl.Add(tbi)
pp.EndUpdateTabs(tbiColl)
doc.EndUpdateParagraphs(pp)