windowsforms-116610-controls-and-libraries-rich-text-editor-examples-styles-how-to-create-new-paragraph-style.md
The following example shows how to create a paragraph style.
To create a paragraph style, follow the steps below.
document.LoadDocument("Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.Docx);
ParagraphStyle pstyle = document.ParagraphStyles["MyPStyle"];
if (pstyle == null)
{
pstyle = document.ParagraphStyles.CreateNew();
pstyle.Name = "MyPStyle";
pstyle.LineSpacingType = ParagraphLineSpacing.Double;
pstyle.Alignment = ParagraphAlignment.Center;
document.ParagraphStyles.Add(pstyle);
}
document.Paragraphs[2].Style = pstyle;
document.LoadDocument("Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.Docx)
Dim pstyle As ParagraphStyle = document.ParagraphStyles("MyPStyle")
If pstyle Is Nothing Then
pstyle = document.ParagraphStyles.CreateNew()
pstyle.Name = "MyPStyle"
pstyle.LineSpacingType = ParagraphLineSpacing.Double
pstyle.Alignment = ParagraphAlignment.Center
document.ParagraphStyles.Add(pstyle)
End If
document.Paragraphs(2).Style = pstyle