officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-paragraphstylecollection-dot-add-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-paragraphstyle-x29.md
Add a style to the collection of styles in the current document.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
void Add(
ParagraphStyle style
)
Sub Add(
style As ParagraphStyle
)
| Name | Type | Description |
|---|---|---|
| style | ParagraphStyle |
A ParagraphStyle class instance representing a paragraph style.
|
A collection of styles in the document can be accessed via the Document.ParagraphStyles property. To create a new style, use the ParagraphStyleCollection.CreateNew method.
The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(ParagraphStyle) method.
Note
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.
winforms-rich-edit-text-formatting/CS/Text Formatting Example/Form1.cs#L107
//Add the object to the document collection
document.ParagraphStyles.Add(chapterStyle);
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Styles.cs#L46
pstyle.Alignment = ParagraphAlignment.Center;
document.ParagraphStyles.Add(pstyle);
}
wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/StylesActions.cs#L46
pstyle.Alignment = ParagraphAlignment.Center;
document.ParagraphStyles.Add(pstyle);
}
winforms-richedit-table-of-contents-practical-guide/CS/Form1.cs#L122
paragraphStyle.OutlineLevel = level;
Document.ParagraphStyles.Add(paragraphStyle);
}
word-document-api-examples/CS/CodeExamples/StylesActions.cs#L79
// Add the style to the collection of paragraph styles.
document.ParagraphStyles.Add(pstyle);
}
winforms-rich-edit-text-formatting/VB/Text Formatting Example/Form1.vb#L102
'Add the object to the document collection
document.ParagraphStyles.Add(chapterStyle)
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Styles.vb#L42
pstyle.Alignment = DevExpress.XtraRichEdit.API.Native.ParagraphAlignment.Center
document.ParagraphStyles.Add(pstyle)
End If
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/StylesActions.vb#L39
pstyle.Alignment = ParagraphAlignment.Center
document.ParagraphStyles.Add(pstyle)
End If
word-document-api-examples/VB/CodeExamples/StylesActions.vb#L67
' Add the style to the collection of paragraph styles.
document.ParagraphStyles.Add(pstyle)
End If
winforms-richedit-table-of-contents-practical-guide/VB/Form1.vb#L113
paragraphStyle.OutlineLevel = level
Document.ParagraphStyles.Add(paragraphStyle)
End If
See Also
ParagraphStyleCollection Interface