Field Class

A field in a sub-document.

Namespace: DevExpress.Blazor.RichEdit

Assembly: DevExpress.Blazor.RichEdit.v21.2.dll

Declaration

public class Field :
    DocumentElementBase

Remarks

A field is a placeholder for data that can change, for instance, a page number, or the current date and time. The Rich Text Editor replaces fields with actual data when it updates fields or prints a document.

Use the Fields property to access methods that allow you to create, get, update fields, and change their display mode.

<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            Field field = await documentAPI.Fields.CreateAsync(0, "DATE");
            await documentAPI.Fields.UpdateAsync(field);
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Field Structure

The Rich Text Editor stores fields in the following form: {Code}Result>. For instance, the field that calculates the current date is stored as {DATE}4/30/2021>.

The Code part specifies how the Result part should be calculated when the field is updated. In a document, a field can be displayed as a code or result according to the field’s display mode.

Rich Text Editor Overview

A field’s Code part has the following syntax:

FIELDNAME Properties Optional_Switches

  • FIELDNAME - the name of the field.
  • Properties - any instructions or variables that are used in a particular field.
  • Optional switches - parameters that contain additional information.

Refer to the following section for a list of supported field codes and their structures: Supported Fields.

Create Fields

You can create a field in the following ways:

  • Pass a position and a Code to the CreateAsync(Int32, String) method to insert a field in the specified position.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                Field field = await documentAPI.Fields.CreateAsync(0, "DATE");
                await documentAPI.Fields.UpdateAsync(field);
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Call the CreateAsync(Interval) or CreateAsync(Int32, Int32) method to wrap an interval that contains a Code in a new field.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                // Accesses a header
                Section section = await documentAPI.Sections.GetAsync(0);
                SubDocument header = await section.GetHeaderAsync(HeaderFooterType.Primary, true);
                // Inserts the "PAGE" text in the header
                TextSpan pageNumber = await header.AddTextAsync("PAGE");
                // Creates a PAGE field
                Field pageField = await header.Fields.CreateAsync(pageNumber.Interval);
                // Updates the field
                await header.Fields.UpdateAsync(pageField);
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    

The Rich Text Editor allows users to create commonly used fields with ribbon commands and hotkeys. Refer to the following section for more information on supported fields: Supported Fields.

Access Fields

Call the GetAsync(Int32) method to access a field by its index in a sub-document. To get all fields a sub-document contains, call the GetAllAsync() method.

The following example shows how to access the first field and all fields in the main sub-document:

<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            Field firstField = await documentAPI.Fields.GetAsync(0);
            IReadOnlyList<Field> fields = await documentAPI.Fields.GetAllAsync();
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

You can get text intervals that contain a field code (CodeInterval), field result (ResultInterval), or entire field (Interval). To get a Text Span in the specified interval, call the GetTextSpanAsync(Interval) method.

<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            Field field = await documentAPI.Fields.CreateAsync(0, "DATE"); // Creates the DATE field
            await documentAPI.GetTextSpanAsync(field.Interval); // Returns a Text Span that contains "{DATE}>"
            await documentAPI.Fields.UpdateAsync(field); // Calculates the field result
            field = await documentAPI.Fields.GetAsync(field.Index); // Gets the updated field
            await documentAPI.GetTextSpanAsync(field.Interval); // Returns a Text Span that contains "{DATE}4/30/2021>"
            await documentAPI.GetTextSpanAsync(field.CodeInterval); // Returns a Text Span that contains "DATE"
            await documentAPI.GetTextSpanAsync(field.ResultInterval); // Returns a Text Span that contains "4/30/2021"
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Update Fields

Update a field to calculate and display the field result. You can use API members or UI to update a field.

  • Call the UpdateAllAsync(Boolean) method to update every field in a sub-document or in all sub-documents.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.UpdateAllAsync(true);
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Call the UpdateAsync(Field) method to update a field.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                Field field = await documentAPI.Fields.CreateAsync(0, "DATE");
                await documentAPI.Fields.UpdateAsync(field);
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeUpdate All Fields ribbon command to update all fields in a document.

  • Select the ReferencesUpdate Table ribbon command to update a TOC field.

  • Select a range that contains field(s) and press F9 to update the field(s).

Delete Fields

A field’s Interval property allows you get the interval that contains the field. Pass a field’s interval to the sub-document’s RemoveAsync(Interval) method to delete the field.

The following example deletes the first field in the main sub-document.

<DxRichEdit @ref="@richEdit" />

@code {
    DxRichEdit richEdit;
    Document documentAPI;
    @* ... *@
    /* Surround the code that contains an asynchronous operation with a try-catch block to handle
    the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
        try {
            documentAPI = richEdit.DocumentAPI;
            @* ... *@
            Field firstField = await documentAPI.Fields.GetAsync(0);
            await documentAPI.RemoveAsync(firstField.Interval);
            @* ... *@
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
}

Display Mode

The Rich Text Editor can display a field as a code (for instance, { DATE }) or result (for instance, 4/30/2021). You can use API members or UI to switch between display modes.

  • Call the ShowAllFieldCodesAsync(Boolean) or ShowAllFieldResultsAsync(Boolean) method to specify the display mode of every field in a sub-document or in all sub-documents.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.ShowAllFieldResultsAsync();
                await documentAPI.Fields.ShowAllFieldCodesAsync();
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Call the ToggleViewAsync(Field) method to change the display mode of a field.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                // Gets the first field in the main sub-document
                Field firstField = await documentAPI.Fields.GetAsync(0);
                // If the Rich Text Editor displays the first field as a code, displays the field as a result
                if (firstField.IsShowCode)
                    await documentAPI.Fields.ToggleViewAsync(firstField);
                    @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeShow All Field Codes or Show All Field Results ribbon command to set display mode of a document’s fields.

  • Press ALT+F9 to change display mode of a document’s fields.

Supported Fields

DATE

Inserts the current date.

{ DATE [ \@ "switch" ] }

The switch specifies the date-time format applied to the field result. The default format is “M/d/yyyy”.

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "DATE");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeCreate FieldDATE ribbon command.

  • Press ALT+SHIFT+D.

DOCVARIABLE

Inserts a value assigned to the document variable.

{ DOCVARIABLE "variable name" "argument1" "argument2"... }

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit  @bind-Selection="@selection" @ref="@richEdit" 
        CalculateDocumentVariable="@(async x => await OnCalculateDocumentVariable(x))" />
    @code {
        DxRichEdit richEdit { get; set; }
        Selection selection { get; set; }
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                await richEdit.DocumentAPI.Fields.CreateAsync(richEdit.Selection.CaretPosition, "DOCVARIABLE paragraphCount");
                await richEdit.DocumentAPI.AddTextAsync("Number of paragraphs: ");
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
            @* ... *@
    }
    
  • Select Mail MergeCreate FieldDOCVARIABLE ribbon command.

When a DOCVARIABLE field is updated, the Rich Text Editor fires the CalculateDocumentVariable event. Specify the event handler to calculate the field result.

<DxRichEdit  @bind-Selection="@selection" @ref="@richEdit" 
    CalculateDocumentVariable="@(async x => await OnCalculateDocumentVariable(x))" />
@code {
    DxRichEdit richEdit { get; set; }
    Selection selection { get; set; }
    @* ... *@
    async Task OnCalculateDocumentVariable(CalculateDocumentVariableEventArgs e) {
        try {
            switch (e.VariableName) {
                case "paragraphCount":
                    var paragraphs = await richEdit.DocumentAPI.Paragraphs.GetAllAsync();
                    e.Value = paragraphs.Count.ToString();
                    break;
                default:
                    break;
            }
        }
        catch (OperationCanceledException e) {
            Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
        }
    }
}

Docvariable field

FILLIN

Displays a dialog box and inserts a user’s response as a field result.

{ FILLIN ["prompt"] [\d "default response"]}

The dialog box appears every time you update the field. The Rich Text Editor does not update the FILLIN field when the document is printed.

Fillin

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "FILLIN \"Type your name\" \\d \"John Doe\"");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeCreate Field ribbon command or press CTRL+F9 to insert an empty field and type the FILLIN code.

Inserts a hyperlink into a bookmark, URL, or e-mail address.

{ HYPERLINK "location" }

Use the sub-document’s Hyperlinks and the Bookmarks properties to access hyperlinks and bookmarks.

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "HYPERLINK https://www.devexpress.com/");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Call a CreateAsync method to add a hyperlink to a sub-document.

    <DxRichEdit @bind-Selection="@selection" @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Selection selection;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
            @* ... *@
                // Insert a hyperlink to a URL
                var position = richEdit.Selection.CaretPosition;
                await documentAPI.Hyperlinks.CreateAsync(position, "Go to Google", "https://www.google.com/");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • The Rich Text Editor automatically (as you type) transforms web references, email addresses or network paths to hyperlinks.

  • Select the InsertHyperlink ribbon command.

NUMPAGES

Inserts the total number of pages in the document.

{ NUMPAGES }

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "NUMPAGES");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeCreate FieldNUMPAGES ribbon command.

  • Select the InsertPage Count ribbon command.

PAGE

Inserts the number of the current page.

{ PAGE }

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "PAGE");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeCreate FieldPAGE ribbon command.

  • Select the InsertPage Number ribbon command.

  • Press ALT+SHIFT+P.

PAGEREF

Inserts a number of the page that stores the specified bookmark.

{ PAGEREF bookmark name [ switches ]}

Use the sub-document’s Bookmarks property to access bookmarks. A bookmark’s Name property returns the name of the bookmark.

Switch Description
\h Creates a hyperlink to the bookmark.

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                Bookmark bookmark = await documentAPI.Bookmarks.GetAsync(0);
                await documentAPI.Fields.CreateAsync(0, "PAGEREF" + bookmark.Name);
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeCreate Field ribbon command or press CTRL+F9 to insert an empty field and type in the PAGEREF code.

SEQ

Sequentially numbers figures, tables, equations, and other items in a document. A table of contents can display SEQ fields.

{ SEQ identifier [ switches ] }

identifier specifies the name of a series of items to number. Predefined identifiers: Figure, Table, and Equation.

Switch Description
\c Repeats the closest preceding sequence number.
\h Hides the field result.
\r number Resets the sequence number to the specified integer.

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "SEQ Figure");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the ReferencesInsert CaptionEquations Caption ribbon command.

  • Select the ReferencesInsert CaptionFigures Caption ribbon command.

  • Select the ReferencesInsert CaptionTables Caption ribbon command.

TC

A non-visual field that creates a table of contents entry. This entry can be displayed in a TOC field.

{ TC "text" [ switches ] }

Switch Description
\f “identifier” Specifies the field’s group identifier that allows you to display only a particular group’s fields in a table of contents.
\l “level number” Specifies the level of the TC entry in a table of contents. The default value is 1.

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "TC text ");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeCreate Field ribbon command or press CTRL+F9 to insert an empty field and type in the TC code.

TIME

Inserts the current time.

{ TIME [ \@ "switch" ] }

The switch specifies the date-time format applied to the field result. The default format is “h:mm am/pm”.

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "TIME");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the Mail MergeCreate FieldTIME ribbon command.

  • Press ALT+SHIFT+T.

TOC

Generates a table of contents, table of figures, table of tables, or table of equations.

{ TOC [ switches ] }

A table of contents can include heading paragraphs, SEQ fields, and TC fields.

The Rich Text Editor does not update a TOC field when the document is printed.

Switch Description
Without switches the table of contents is built based on heading paragraphs.
\h Inserts entries as hyperlinks.
\n “levelStart-levelEnd” Omits page numbers in the table of contents from the specified levels (for instance, { TOC \n 1-1 } omits page numbers from level 1). When the range is not specified, omits page numbers from all levels.
\o “levelStart-levelEnd” Builds a table of contents from paragraphs with specified outline levels. For example, { TOC \o “1-3” } lists only paragraphs with outline levels 1 through 3.
\c “seq field identifier” Builds a table of contents from items that have SEQ fields. The SEQ fields’ identifier should match the “seq field identifier”.
\f “TC identifier” Builds a table of contents from TC fields. TC fields’ identifier should match the “TC identifier”.
\p “separator” Specifies the characters that separate sequence numbers and page numbers. The default separator is a tab with leader dots. You can use up to five characters enclosed in quotation marks.

You can create this field in the following ways:

  • Call a CreateAsync method.

    <DxRichEdit @ref="@richEdit" />
    
    @code {
        DxRichEdit richEdit;
        Document documentAPI;
        @* ... *@
        /* Surround the code that contains an asynchronous operation with a try-catch block to handle
        the OperationCanceledException. This exception is thrown when an asynchronous operation is cancelled. */
            try {
                documentAPI = richEdit.DocumentAPI;
                @* ... *@
                await documentAPI.Fields.CreateAsync(0, "TOC");
                @* ... *@
            }
            catch (OperationCanceledException e) {
                Console.WriteLine($"{nameof(OperationCanceledException)} thrown with message: {e.Message}");
            }
    }
    
  • Select the ReferencesTable of Contents ribbon command.

  • Select the ReferencesInsert Table of FiguresTable of Equations ribbon command.

  • Select the ReferencesInsert Table of FiguresTable of Figures ribbon command.

  • Select the ReferencesInsert Table of FiguresTable of Tables ribbon command.

Inheritance

See Also