Skip to main content

How to: Change Formatting of the Current Paragraph

View Example

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)