The requested page is not available for the requested platform. You are viewing the content for Default platform.

RichEditDocumentBase Class

Defines a document in the Rich Text Editor.

Declaration

export class RichEditDocumentBase

Properties

bookmarks Property

Provide access to the document's collection of bookmarks.

Declaration

readonly bookmarks: BookmarkCollection<Bookmark>

Property Value

Type Description
BookmarkCollection<Bookmark>

A collection of bookmarks.

fonts Property

Provide access to the document's collection of fonts.

Declaration

readonly fonts: FontCollection

Property Value

Type Description
FontCollection

A collection of fonts.

Remarks

Use this property to access the fonts available in the document.

//reduces the document's font collection to the specified fonts
var myFonts = ['Arial', 'Calibri'];
richEdit.document.fonts.getAllFontNames().forEach(fontName => 
    myFonts.find(myFontName => 
        myFontName == fontName) ? null : richEdit.document.fonts.getByName(fontName).delete());

length Property

Gets the character length of the document.

Declaration

readonly length: number

Property Value

Type Description
number

The number of character positions in the sub-document.

Remarks

function onDocumentLoaded(s, e) {
    s.document.insertText(0, 'Dear Mr Stanley,');
    s.document.insertParagraph(s.document.length);
    var startPosition = s.document.length;
    s.document.insertParagraph(startPosition);
    s.document.insertText(startPosition, '[Type your text here]');
    s.selection.setSelection(new DevExpress.RichEdit.Interval(startPosition, s.document.length - startPosition));
    s.focus();
}

For a full example, see Ribbon Customization demo.

lists Property

Provide access to the document's collection of lists.

Declaration

readonly lists: ListCollection

Property Value

Type Description
ListCollection

A collection of lists.

paragraphs Property

Provide access to the document's collection of paragraphs.

Declaration

readonly paragraphs: ParagraphCollection

Property Value

Type Description
ParagraphCollection

A collection of paragraphs.

sections Property

Provide access to the document's collection of sections.

Declaration

readonly sections: SectionCollection

Property Value

Type Description
SectionCollection

A collection of sections.

subDocuments Property

Provide access to the document's collection of sub-documents.

Declaration

readonly subDocuments: SubDocumentsCollection

Property Value

Type Description
SubDocumentsCollection

A collection of sub-documents.

tables Property

Provide access to the document's collection of tables.

Declaration

readonly tables: TableCollection

Property Value

Type Description
TableCollection

A collection of tables.

Methods

deleteText(interval) Method

Deletes the specified text interval.

Declaration

deleteText(interval: IInterval): void

Parameters

Name Type Description
interval IInterval

The text interval to delete.

Remarks


richEdit.document.deleteText({start: 10, length: 15});

getCharacterProperties(interval) Method

Returns character properties of the specified text interval.

Declaration

getCharacterProperties(interval: IInterval): CharacterProperties

Parameters

Name Type Description
interval IInterval

An object that contains information about a text interval.

Returns

Type Description
CharacterProperties

An object that contains the character properties.

getParagraphProperties(interval) Method

Returns paragraph properties of the specified text interval.

Declaration

getParagraphProperties(interval: IInterval): ParagraphProperties

Parameters

Name Type Description
interval IInterval

An object that contains information about a text interval.

Returns

Type Description
ParagraphProperties

An object that contains the paragraph properties.

getText Method

Return the document's textual representation contained in the specified interval.

Declaration

getText(interval?: Interval): string

Optional Parameters

Name Type Default Description
interval Interval null

A document interval.

Returns

Type Description
string

The text contained in the specified interval.

insertLineBreak(position) Method

Inserts the line break at the specified position in the document.

Declaration

insertLineBreak(position: number): Interval

Parameters

Name Type Description
position number

A position in the document.

Returns

Type Description
Interval

The interval that contains the inserted line break.

insertParagraph(position) Method

Inserts a paragraph mark to the specified position.

Declaration

insertParagraph(position: number): Paragraph

Parameters

Name Type Description
position number

The position in the document.

Returns

Type Description
Paragraph

The newly created paragraph.

Remarks

function onDocumentLoaded(s, e) {
    s.document.insertText(0, 'Dear Mr Stanley,');
    s.document.insertParagraph(s.document.length);
    var startPosition = s.document.length;
    s.document.insertParagraph(startPosition);
    s.document.insertText(startPosition, '[Type your text here]');
    s.selection.setSelection(new DevExpress.RichEdit.Interval(startPosition, s.document.length - startPosition));
    s.focus();
}

For a full example, see Ribbon Customization demo.

insertPicture(position, base64) Method

Inserts a picture to the document.

Declaration

insertPicture(position: number, base64: string, size?: Size, callback?: (interval: Interval) => void): void

Parameters

Name Type Description
position number

A position in the document.

base64 string

The picture in string representation that is encoded with base-64 digits.

Optional Parameters

Name Type Default Description
size Size null

The image size.

callback (interval: Interval) => void null

A function that is called after the picture is inserted.

insertSectionBreak(position, type) Method

Inserts the section break at the specified position in the document.

Declaration

insertSectionBreak(position: number, type: SectionBreakType): void

Parameters

Name Type Description
position number

A position in the document.

type SectionBreakType

The type of a section break.

insertText(position, text) Method

Inserts the specified text at the specified position.

Declaration

insertText(position: number, text: string): Interval

Parameters

Name Type Description
position number

A position to insert the text.

text string

The text to insert.

Returns

Type Description
Interval

The interval that contains the inserted text.

Remarks

function onDocumentLoaded(s, e) {
    s.document.insertText(0, 'Dear Mr Stanley,');
    s.document.insertParagraph(s.document.length);
    var startPosition = s.document.length;
    s.document.insertParagraph(startPosition);
    s.document.insertText(startPosition, '[Type your text here]');
    s.selection.setSelection(new DevExpress.RichEdit.Interval(startPosition, s.document.length - startPosition));
    s.focus();
}

For a full example, see Ribbon Customization demo.

setCharacterProperties(interval, characterProperties) Method

Applies character properties to a text interval.

Declaration

setCharacterProperties(interval: IInterval, characterProperties: CharacterProperties): void

Parameters

Name Type Description
interval IInterval

An object that contains information about a text interval.

characterProperties CharacterProperties

An object that contains the applied character properties.

setParagraphProperties(interval, paragraphProperties) Method

Applies paragraph properties to a text interval.

Declaration

setParagraphProperties(interval: IInterval, paragraphProperties: ParagraphProperties): void

Parameters

Name Type Description
interval IInterval

An object that contains information about a text interval.

paragraphProperties ParagraphProperties

An object that contains the applied paragraph properties.