Skip to main content
All docs
V24.2

DxHtmlEditorVariables.EscapeCharacters Property

Specifies escape sequences that enclose placeholder variables in the document.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.2.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public object EscapeCharacters { get; set; }

Property Value

Type Description
Object

The escape characters.

Remarks

<DxHtmlEditor> supports placeholder variables you can use to create templates for document generation. When a user clicks the toolbar’s Variable command, the component displays a drop-down list of available variables. The editor inserts the selected placeholder variable at the caret position in the document and encloses the variable between escape sequences. The default escape sequences are { and }.

Specify the EscapeCharacters property if you need to change escape sequences. This property accepts one string value or an array of strings.

Example

The following code snippet implements placeholder variables and adds the Variable command to the built-it toolbar:

Html Editor - Variables

@using DevExpress.Blazor.Office

<DxHtmlEditor Height="200px"
              CustomizeToolbar="@OnCustomizeToolbar">
    <DxHtmlEditorVariables Data=@Variables
                           EscapeCharacters="@escapeChar" />
</DxHtmlEditor>

@code {
    string[] Variables = new string[] { "FirstName", "LastName" };
    // Declare one string
    string escapeChar = "$";
    // Declare an array of strings
    string[] escapeChar = new string[] { "$", "$" };

    void OnCustomizeToolbar(IToolbar toolbar) {
        toolbar.Groups.Add(HtmlEditorToolbarGroupNames.Variable);
    }
}
See Also