Back to Devexpress

Text Content (Text Buffer)

aspnet-117599-components-rich-text-editor-document-document-model-text-content-text-buffer.md

latest2.8 KB
Original Source

Text Content (Text Buffer)

  • Dec 17, 2020
  • 3 minutes to read

Overview

The basis of a sub-document is its actual text content. This content is stored within a sub-document’s text buffer that can be accessed on the client using the SubDocument.text property. This is a separate logical stream of text containing all textual parts in a sub-document, such as paragraphs, lists, tables, and etc. All sub-document parts are bound to certain positions within the text buffer. The text buffer uses a plain one-dimensional coordinate system to identify character locations in the buffer. A coordinate position is based on a character’s position from the first character in the buffer.

Element Marking

All entities of sub-document parts have their own symbol marks. In particular, these are:

  • Simple text - for a continuous set of characters;
  • End marks - for paragraphs;
  • Break marks - for lines, columns, tables, pages, sections;
  • Specific marks - for spaces, tabulations, inline pictures, fields and etc.

The text buffer contains contiguous pieces of text (text characters and specific symbol marks) with no additional text markup. Some examples:

  • If RichEdit’s main sub-document displays a sentence that has two words with different font formatting and ends with a paragraph mark:

  • If a sub-document contains only an inline picture and a paragraph mark, the text buffer does not contain any real text. It contains just two specific mark symbols - one to mark the inline picture and another - to mark the paragraph end. The text buffer’s length is 2.

Show/Hide Mark Symbols

The RichEdit has two modes of displaying formatting marks on the screen.

  • Hide formatting marks

  • Show formatting marks

The display mode of formatting marks can be changed by pressing the “Crtl+Shift+8” key combination.

Client API

Client commands provide a set of methods that can be used to insert and delete text and special symbols in the following notation:

clientRichEditName.commands.showHiddenSymbols.execute(parameter_if_any)

Use the RichEditCommands.showHiddenSymbols command in the following notation, to programmatically toggle the visibility of formatting marks:

clientRichEditName.commands.showHiddenSymbols.execute(parameter_if_any)

A sub-document object (SubDocument) exposes the following text buffer related properties, which can be used in the notation given below:

clientRichEditName.document.activeSubDocument.propertyName

Property NameLinkDescription
textSubDocument.textGets the document’s text.
lengthSubDocument.lengthGets the length of the sub-document.