Back to Devexpress

Document.CharacterStyles Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-4133e4f2.md

latest5.4 KB
Original Source

Document.CharacterStyles Property

Provides access to a collection of character styles in the current document.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
CharacterStyleCollection CharacterStyles { get; }
vb
ReadOnly Property CharacterStyles As CharacterStyleCollection

Property Value

TypeDescription
CharacterStyleCollection

A CharacterStyleCollection collection containing character styles.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the CharacterStyles property.

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-richedit-document-api/CS/RichEditAPISample/CodeExamples/Styles.cs#L16

csharp
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
CharacterStyle cstyle = document.CharacterStyles["MyCStyle"];
if (cstyle == null)

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/StylesActions.cs#L16

csharp
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
CharacterStyle cstyle = document.CharacterStyles["MyCStyle"];
if (cstyle == null)

word-document-api-examples/CS/CodeExamples/StylesActions.cs#L27

csharp
// Access the character style with the specified name.
CharacterStyle cstyle = document.CharacterStyles["MyCStyle"];

winforms-richedit-enable-line-numbering-and-count-document-rows/CS/LineNumberingExample/Form1.cs#L55

csharp
}
DevExpress.XtraRichEdit.API.Native.CharacterStyle style = richEditControl1.Document.CharacterStyles["Line Number"];
MyPagePainter customPagePainter = new MyPagePainter(richEditControl1, SystemColors.Info, style);

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Styles.vb#L15

vb
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
Dim cstyle As DevExpress.XtraRichEdit.API.Native.CharacterStyle = document.CharacterStyles("MyCStyle")
If cstyle Is Nothing Then

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/StylesActions.vb#L13

vb
document.LoadDocument("Documents//Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml)
Dim cstyle As CharacterStyle = document.CharacterStyles("MyCStyle")
If cstyle Is Nothing Then

word-document-api-examples/VB/CodeExamples/StylesActions.vb#L26

vb
' Access the character style with the specified name.
Dim cstyle As DevExpress.XtraRichEdit.API.Native.CharacterStyle = document.CharacterStyles("MyCStyle")
' If the style with the specified name does not exist

winforms-richedit-enable-line-numbering-and-count-document-rows/VB/LineNumberingExample/Form1.vb#L50

vb
Dim style As API.Native.CharacterStyle = richEditControl1.Document.CharacterStyles("Line Number")
Dim customPagePainter As MyPagePainter = New MyPagePainter(richEditControl1, SystemColors.Info, style)

See Also

Document Interface

Document Members

DevExpress.XtraRichEdit.API.Native Namespace