Table of Contents

Getting started

Requirements

  • Delphi 10.1 Berlin or later
  • TMS FNC Core (required dependency)
  • TMS FNC UI Pack

Drop the component

  1. Drop a TTMSFNCRichEditor onto a form.
  2. Optionally drop a TTMSFNCRichEditorToolBar and set its RichEditor property to the editor.
  3. Arrange the toolbar above or below the editor using Align.

Basic usage

// Set initial content
RichEditor1.Text := 'Hello, world!';

// Select all and apply bold
RichEditor1.SelectAll;
RichEditor1.Bold := True;

// Insert formatted text at cursor
RichEditor1.InsertText('Important: ');

Connecting the toolbar

RichEditorToolBar1.RichEditor := RichEditor1;

The toolbar automatically enables and disables its buttons based on the current selection.

HTML import and export

var IO: TTMSFNCRichEditorIO;
begin
  IO := TTMSFNCRichEditorIO.Create(nil);
  try
    // Load HTML
    IO.RichEditor := RichEditor1;
    IO.LoadFromFile('document.html');

    // Save HTML
    IO.SaveToFile('output.html');
  finally
    IO.Free;
  end;
end;

Next steps