Back to Devexpress

CharacterPropertiesBase.Reset(CharacterPropertiesMask) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-characterpropertiesbase-dot-reset-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-characterpropertiesmask-x29.md

latest7.1 KB
Original Source

CharacterPropertiesBase.Reset(CharacterPropertiesMask) Method

Resets the character formatting properties specified by the mask to the properties of the underlying character style or to default properties.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void Reset(
    CharacterPropertiesMask mask
)
vb
Sub Reset(
    mask As CharacterPropertiesMask
)

Parameters

NameTypeDescription
maskCharacterPropertiesMask

A CharacterPropertiesMask enumeration value.

|

Remarks

The Reset method sets character properties to the Normal style. The mask allows you to specify character properties which will be reset.

The following code snippet modifies CharacterPropertiesBase.FontSize and CharacterPropertiesBase.FontName properties. These properties are reset to Document.DefaultCharacterProperties values if no specific character style is applied. Other character properties remain unchanged.

View Example

csharp
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;

using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer()) {
    Document document = wordProcessor.Document;
    document.LoadDocument("Grimm.docx", DocumentFormat.Docx);

    // Set font size and font name of the characters in the first paragraph to default. 
    // Other character properties remain intact.
    DocumentRange range = document.Paragraphs[0].Range;
    CharacterProperties cp = document.BeginUpdateCharacters(range);
    cp.Reset(CharacterPropertiesMask.FontSize | CharacterPropertiesMask.FontName);
    document.EndUpdateCharacters(cp);
}
vb
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native

Using wordProcessor As New RichEditDocumentServer()
    Dim document As Document = wordProcessor.Document
    document.LoadDocument("Grimm.docx", DocumentFormat.Docx)

    ' Set font size and font name of the characters in the first paragraph to default. 
    ' Other character properties remain intact.
    Dim range As DocumentRange = document.Paragraphs(0).Range
    Dim cp As CharacterProperties = document.BeginUpdateCharacters(range)
    cp.Reset(CharacterPropertiesMask.FontSize Or CharacterPropertiesMask.FontName)
    document.EndUpdateCharacters(cp)
End Using

The following code snippets (auto-collected from DevExpress Examples) contain references to the Reset(CharacterPropertiesMask) 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/Formatting.cs#L43

csharp
CharacterProperties cp = document.BeginUpdateCharacters(range);
cp.Reset(CharacterPropertiesMask.FontSize | CharacterPropertiesMask.FontName);
document.EndUpdateCharacters(cp);

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/FormattingActions.cs#L35

csharp
CharacterProperties cp = document.BeginUpdateCharacters(range);
cp.Reset(CharacterPropertiesMask.FontSize | CharacterPropertiesMask.FontName);
document.EndUpdateCharacters(cp);

word-document-api-examples/CS/CodeExamples/FormattingActions.cs#L102

csharp
// Other character properties remain intact.
cp.Reset(CharacterPropertiesMask.FontSize | CharacterPropertiesMask.FontName | CharacterPropertiesMask.FontNameAscii);

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Formatting.vb#L39

vb
Dim cp As DevExpress.XtraRichEdit.API.Native.CharacterProperties = document.BeginUpdateCharacters(range)
cp.Reset(DevExpress.XtraRichEdit.API.Native.CharacterPropertiesMask.FontSize Or DevExpress.XtraRichEdit.API.Native.CharacterPropertiesMask.FontName)
document.EndUpdateCharacters(cp)

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/FormattingActions.vb#L31

vb
Dim cp As CharacterProperties = document.BeginUpdateCharacters(range)
cp.Reset(CharacterPropertiesMask.FontSize Or CharacterPropertiesMask.FontName)
document.EndUpdateCharacters(cp)

word-document-api-examples/VB/CodeExamples/FormattingActions.vb#L82

vb
' Other character properties remain intact.
cp.Reset(DevExpress.XtraRichEdit.API.Native.CharacterPropertiesMask.FontSize Or DevExpress.XtraRichEdit.API.Native.CharacterPropertiesMask.FontName Or DevExpress.XtraRichEdit.API.Native.CharacterPropertiesMask.FontNameAscii)
' Finalize to modify character formatting.

See Also

CharacterPropertiesBase Interface

CharacterPropertiesBase Members

DevExpress.XtraRichEdit.API.Native Namespace