Skip to main content
.NET Framework 4.5.2+

ParagraphStyle Interface

Exposes methods and characteristics of a paragraph style in a document.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v23.1.Core.dll

NuGet Package: DevExpress.RichEdit.Core


public interface ParagraphStyle :


Use the paragraph style to change both character (a font type, size, color, etc.) and paragraph (alignment, spacing before and after, etc.) attributes as in the current example. RichEditDocumentServer doesn’t have any predefined document styles. Use members from the table below to create a new document style.

The code sample below demonstrates creates a new paragraph style and apply it to every chapter.


//Open the document for editing

//Create a new paragraph style instance
//and specify the required properties
ParagraphStyle chapterStyle = document.ParagraphStyles.CreateNew();
chapterStyle.Name = "MyTitleStyle";
chapterStyle.ForeColor = Color.SteelBlue;
chapterStyle.FontSize = 16;
chapterStyle.FontName = "Segoe UI Semilight";
chapterStyle.Alignment = ParagraphAlignment.Left;
chapterStyle.SpacingBefore = Units.InchesToDocumentsF(0.2f);
chapterStyle.SpacingAfter = Units.InchesToDocumentsF(0.2f);
chapterStyle.OutlineLevel = 2;

//Add the object to the document collection

//Finalize the editing

//Apply the created style to every chapter in the document 
for (int i = 0; i < document.Paragraphs.Count; i++)
    string var = document.GetText(document.Paragraphs[i].Range);
    if (var.Contains("Chapter "))
        document.Paragraphs[i].Style = chapterStyle;

If the loaded document already has document styles, they are automatically added to the document’s CharacterStyleCollection or ParagraphStyleCollection and you can use them as shown in the code snippet below.

//Apply style to the paragraph
richEditDocumentServer1.Document.Paragraphs[1].Style = richEditDocumentServer1.Document.ParagraphStyles["Heading 2"];

//Apply style to the character range
DocumentRange range = richEditDocumentServer1.Document.Paragraphs[1].Range;
CharacterProperties rangeProperties = richEditDocumentServer1.Document.BeginUpdateCharacters(range);
rangeProperties.Style = richEditDocumentServer1.Document.CharacterStyles["Heading 2"];


Load an empty document created in Microsoft® Word® using the Document.LoadDocument method in the RichEditDocumentServer.EmptyDocumentCreated event handler to fill the collection of a newly created document with the predefined styles.

See Also