Skip to content

TWebRichEdit

Description

Below is a list of the most important properties methods and events for TWebRichEdit. TWebRichEdit is a control that allows to edit text and apply text formatting. TWebRichEdit is similar to a VCL TRichEdit.

Designtime Runtime

HTML template tag

The HTML tag the component can be associated with in an HTML template. Assign the ID attribute with a unique value and set the identical value to the ElementID property. Detailed information can be found in the Use of HTML templates topic.

HTML tag <DIV ID=”UniqueID”></DIV>
ElementID UniqueID

Properties for TWebRichEdit

Property Description
AutoSize When true, the size of the label control automatically adapts to the text it contains
BorderStyle Sets the border style
CursorPosition: integer Gets or sets the cursor position in the rich edit control
ElementClassName Optionally sets the CSS classname for the label when styling via CSS is used
ElementID Optionally sets the HTML element ID for a HTML element in the form HTML file the label needs to be connected with. When connected, no new label is created but the Delphi class is connected with the existing HTML element in the form HTML file
PlainText Gets or sets the text of the rich editor control as plain text
SelAttributes Gets or sets the attributes of the selected text in the rich editor control
Text Gets or sets the text of the rich editor control as HTML formatted text
Lines: TStrings Gets or sets the text of the rich editor control as HTML formatted text.
Note that when the content of the WebRichEdit changed, to first call WebRichEdit.GetContent and then access WebRichEdit.Lines
WantImages: boolean When true, it is allowed to paste images in the control
WantTab: boolean When true, pressing Tab key enters a tab character in the control, otherwise, sets the focus to the next control

Methods for TWebRichEdit

Method Description
AppendHTML(HTML: string) Append HTML code to the rich editor
AppendLineBreak Append a linebreak at the end of the rich editor
DoEditAction(StartPosition, EndPosition: Integer); Perform an action on the selected text. See the execCommand() in the JavaScript doc for possible actions
DoSelectionAction(ActionString: string; Data: string) Select text from StartPosition to EndPosition
GetContent Transfers the formatted text of the rich editor to the Lines: TStrings property
GetSelection Gets the selected text as plain text string
InsertHTML(HTML: string) Insert HTML code in the rich editor at cursor position
InsertLineBreak Insert a linebreak in the rich editor at cursor position
SelectText(StartPosition, EndPosition: Integer); Select text from StartPosition to EndPosition

Events for TWebRichEdit

Property Description
OnClick Triggered when the rich editor is clicked
OnDblClick Triggered when the rich editor is double-clicked
OnChange Triggered when the content of the richeditor changes
OnSelectionChange Triggered when the selection within the rich editor is changed