Exposes methods and characteristics of a paragraph style in a document.
A style pertains to a document. It belongs to a particular document model and you cannot just add the style object from a style collection of one document to the style collection of another document.
The following code snippet creates a new paragraph style via the ParagraphStyleCollection.CreateNew method, specifies style settings, adds it to the document style collection and applies the style to the currently selected paragraph.
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
document.LoadDocument("Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml) 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
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ParagraphStyle interface.
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.