Back to Devexpress

CharacterStyleCollection.CreateNew() Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-characterstylecollection.md

latest5.1 KB
Original Source

CharacterStyleCollection.CreateNew() Method

Creates a new character style.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
CharacterStyle CreateNew()
vb
Function CreateNew As CharacterStyle

Returns

TypeDescription
CharacterStyle

A CharacterStyle object representing a character style.

|

Remarks

Use the CharacterStyleCollection.Add method to add a newly created style to the collection.

The following code snippets (auto-collected from DevExpress Examples) contain references to the CreateNew() 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-richedit-document-api/CS/RichEditAPISample/CodeExamples/Styles.cs#L19

csharp
{
    cstyle = document.CharacterStyles.CreateNew();
    cstyle.Name = "MyCStyle";

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

csharp
{
    cstyle = document.CharacterStyles.CreateNew();
    cstyle.Name = "MyCStyle";

winforms-rich-edit-text-formatting/CS/Text Formatting Example/Form1.cs#L144

csharp
//to the custom paragraph style
CharacterStyle annotationCharStyle = document.CharacterStyles.CreateNew();
annotationCharStyle.Name = "AnnotationChar";

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

csharp
{
    cstyle = document.CharacterStyles.CreateNew();
    cstyle.Name = "MyCStyle";

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

vb
If cstyle Is Nothing Then
    cstyle = document.CharacterStyles.CreateNew()
    cstyle.Name = "MyCStyle"

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

vb
If cstyle Is Nothing Then
    cstyle = document.CharacterStyles.CreateNew()
    cstyle.Name = "MyCStyle"

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

vb
If cstyle Is Nothing Then
    cstyle = document.CharacterStyles.CreateNew()
    cstyle.Name = "MyCStyle"

winforms-rich-edit-text-formatting/VB/Text Formatting Example/Form1.vb#L136

vb
'to the custom paragraph style
Dim annotationCharStyle As CharacterStyle = document.CharacterStyles.CreateNew()
annotationCharStyle.Name = "AnnotationChar"

See Also

Add(CharacterStyle)

CharacterStyleCollection Interface

CharacterStyleCollection Members

DevExpress.XtraRichEdit.API.Native Namespace