Skip to main content
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

Basic usagePascalC++
// 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: ');
// Set initial content
RichEditor1->Text = "Hello, world!";

// Select all and apply bold
RichEditor1->SelectAll();
RichEditor1->SetSelectionBold(true);

// Insert formatted text at cursor
RichEditor1->InsertText("Important: ");

Connecting the toolbar

Connecting the toolbarPascalC++
RichEditorToolBar1.RichEditor := RichEditor1;
RichEditorToolBar1->RichEditor = RichEditor1;

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

HTML import and export

HTML import and exportPascalC++
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;
TTMSFNCRichEditorHTMLIO *IO = new TTMSFNCRichEditorHTMLIO(NULL);
try
{
  // Load HTML
  IO->RichEditor = RichEditor1;
  IO->Load("document.html");

  // Save HTML
  IO->Save("output.html");
}
__finally
{
  delete IO;
}

Next steps