Skip to main content

Options Interface

Declares Rich Text Editor options.

Declaration

export interface Options

Properties

authentication Property

Provides access to authentication settings.

Declaration

authentication?: IAuthenticationSettings

Property Value

Type Description
IAuthenticationSettings

An interface that declares authentication settings.

autoCorrect Property

Provides access to autocorrect settings.

Declaration

autoCorrect?: IAutocorrectSettings

Property Value

Type Description
IAutocorrectSettings

An interface that declares autocorrect settings.

bookmarks Property

Provides access to bookmark settings.

Declaration

bookmarks?: IBookmarkSettings

Property Value

Type Description
IBookmarkSettings

An interface that declares bookmark settings.

confirmOnLosingChanges Property

Allows you to customize settings of a confirmation message that is displayed when unsaved data changes may be lost.

Declaration

confirmOnLosingChanges?: IConfirmOnLosingChangesSettings

Property Value

Type Description
IConfirmOnLosingChangesSettings

An interface that declares confirmation message settings.

Remarks

options.confirmOnLosingChanges.enabled = true;
options.confirmOnLosingChanges.message = "Are you sure you want to close the document?";

contextMenu Property

Provides access to context menu settings.

Declaration

contextMenu?: IContextMenu

Property Value

Type Description
IContextMenu

An object that implements the IContextMenu interface and contains the context menu settings.

Remarks

const options = DevExpress.RichEdit.createOptions();
var contextMenu = options.contextMenu;
// remove default items
contextMenu.removeItem(DevExpress.RichEdit.ContextMenuCommandId.DecreaseParagraphIndent);
contextMenu.removeItem(DevExpress.RichEdit.ContextMenuCommandId.IncreaseParagraphIndent);
// add an item that executes a default command
contextMenu.insertItem(new DevExpress.RichEdit.ContextMenuItem(
    DevExpress.RichEdit.MailMergeTabCommandId.CreateDateField, {
    icon: 'clock', text: 'Insert Date Field'
}), 1);
// add a custom item
contextMenu.insertItem(new DevExpress.RichEdit.ContextMenuItem('googleSearch', {
    icon: 'search', beginGroup: true, text: 'Google Search...'
}), 1);
See Also

document Property

Specifies a document that is initially loaded in the control.

Declaration

document?: {
    content?: File | Blob | ArrayBuffer | string;
    name?: string;
    format?: DocumentFormat;
    onLoaded?: (importSuccess: boolean) => void;
}

Property Value

Name Type Description
content string | File | Blob | ArrayBuffer

The document content.

format DocumentFormat

The document format.

name string

The document name.

onLoaded (importSuccess: boolean) => void

A function that is called after the control attempted to load the document. The importSuccess parameter specifies whether the document is successfully loaded.

Remarks

var documentAsBase64 = "e1xydGYxXGRlZmYwe1xmb250dGJse1xmMCBDYWxpYnJpO319e1xjb2xvcnRibCA7XHJlZDB"
    + "cZ3JlZW4wXGJsdWUyNTUgO1xyZWQyNTVcZ3JlZW4yNTVcYmx1ZTI1NSA7fXtcKlxkZWZjaHAgXGZzMjJ9e1xzdHl"    
    + "sZXNoZWV0IHtccWxcZnMyMiBOb3JtYWw7fXtcKlxjczFcZnMyMiBEZWZhdWx0IFBhcmFncmFwaCBGb250O317XCp"
    + "cY3MyXGZzMjJcY2YxIEh5cGVybGluazt9e1wqXHRzM1x0c3Jvd2RcZnMyMlxxbFx0c3ZlcnRhbHRcdHNjZWxsY2J"
    + "wYXQyXHRzY2VsbHBjdDBcY2x0eGxydGIgTm9ybWFsIFRhYmxlO319e1wqXGxpc3RvdmVycmlkZXRhYmxlfXtcaW5"
    + "mb31cbm91aWNvbXBhdFxzcGx5dHduaW5lXGh0bWF1dHNwXGV4cHNocnRuXHNwbHRwZ3BhclxkZWZ0YWI3MjBcc2V"
    + "jdGRcbWFyZ2xzeG4xNDQwXG1hcmdyc3huMTQ0MFxtYXJndHN4bjE0NDBcbWFyZ2JzeG4xNDQwXGhlYWRlcnk3MjB"
    + "cZm9vdGVyeTcyMFxwZ3dzeG4xMjI0MFxwZ2hzeG4xNTg0MFxjb2xzMVxjb2xzeDcyMFxwYXJkXHBsYWluXHFse1x"
    + "mczIyXGNmMFxjczEgRG9jdW1lbnQgdGV4dH1cZnMyMlxjZjBccGFyfQ==";
options.document = {
    content: documentAsBase64,
    format: DevExpress.RichEdit.DocumentFormat.Rtf,
    onLoaded: function(success) {
        console.log('Initial document is loaded: ' + success);
    },
};

If the document property is not specified, the control creates and loads a new document.

After the onLoaded function is processed, the documentLoaded event is fired.

events Property

Provides access to a list of client-side events specific to the RichEdit control.

Declaration

events: EventHandlers

Property Value

Type Description
EventHandlers

An object that allows you to assign handlers to the client-side events.

exportUrl Property

Specifies the path where the exported document is sent for saving.

Declaration

exportUrl?: string

Property Value

Type Description
string

The URL.

Remarks

When a user clicks the Save button or the saveDocument method is called, the Rich Text Editor converts the document’s content to base64 and invokes the Saving event. If the event is not handled, specify the exportUrl property to save the document on the server side.

You can write the Saved event handler to perform custom actions after a server sends a response to a save request.

The ExportUrl property is not in effect if the document saving is implemented on the client side (the handled property is set to true).

Note

When RichText Editor sends a document to the server, the control encodes the document content in UTF-8. To get the file content in string format, use a converter.

byte[] fileContents = System.Convert.FromBase64String(base64);
string rtfText = Encoding.UTF8.GetString(fileContents);
See Also

fields Property

Provides access to field settings.

Declaration

fields?: IFieldsSettings

Property Value

Type Description
IFieldsSettings

An interface that declares field settings.

fonts Property

Provides access to font settings.

Declaration

fonts?: IRichEditFontsSettings

Property Value

Type Description
IRichEditFontsSettings

An interface that declares font settings.

height Property

Specifies the RichEdit height.

Declaration

height?: string

Property Value

Type Description
string

The height.

mailMerge Property

Provides access to mail merge settings.

Declaration

mailMerge?: IMailMergeSettings

Property Value

Type Description
IMailMergeSettings

An interface that declares mail merge settings.

pdf Property

Provides access to PDF export settings.

Declaration

pdf?: IRichEditPdfSettings

Property Value

Type Description
IRichEditPdfSettings

An interface that declares PDF export settings.

printing Property

Provides access to printing settings.

Declaration

printing?: IPrintingSettings

Property Value

Type Description
IPrintingSettings

An interface that declares printing settings.

rangePermissions Property

Provides access to range permission settings.

Declaration

rangePermissions?: IRangePermissionsSettings

Property Value

Type Description
IRangePermissionsSettings

An interface that declares range permission settings.

readOnly Property

Specifies whether document modifications are prohibited.

Declaration

readOnly?: boolean

Property Value

Type Description
boolean

true, if the document is in a read-only state; otherwise, false.

Remarks

options.readOnly = true; 

ribbon Property

Provides access to ribbon settings.

Declaration

ribbon: Ribbon

Property Value

Type Description
Ribbon

An object that contains ribbon settings.

See Also

Provides access to search settings.

Declaration

search?: IRichEditSearchSettings

Property Value

Type Description
IRichEditSearchSettings

Search settings.

Remarks

The search panel and the Find and Replace dialog allow users to locate and modify text in a document opened in the Rich Text Editor. You can filter search results to prevent users from modifying certain document intervals. The example below demonstrates how to exclude intervals that contain fields from search results:

const options = DevExpress.RichEdit.createOptions();
options.search.filterInterval = (subDocument, interval) =>
    subDocument.fields.find(interval).length == 0;
// ...

spellCheck Property

Provides access to spell checking settings.

Declaration

spellCheck?: ISpellCheck

Property Value

Type Description
ISpellCheck

An interface that declares spell checking settings.

unit Property

Specify unit for dimensions in Rich Text Editor dialogs.

Declaration

unit?: RichEditUnit

Property Value

Type Description
RichEditUnit

The unit.

Remarks

options.unit = DevExpress.RichEdit.RichEditUnit.Centimeter;

view Property

Provides access to view settings.

Declaration

view?: IViewSettings

Property Value

Type Description
IViewSettings

An interface that declares view settings.

width Property

Specifies the RichEdit width.

Declaration

width?: string

Property Value

Type Description
string

The width.