Documentação HotXLS

Classes TXLSXRichText e TXLSXRichTextRun

TXLSXRichText armazena trechos de texto formatado para TXLSXCell.RichText e texto formatado de comentários na fachada XLSX

Declarações

type
  TXLSXRichText = class
    function AddRun: TXLSXRichTextRun;
    function AddRunText(const AText: WideString): TXLSXRichTextRun;
    procedure Clear;
    function PlainText: WideString;
    property RunCount: Integer;
    property Runs[Index: Integer]: TXLSXRichTextRun;
  end;

  TXLSXRichTextRun = class
    property Text, Name: WideString;
    property Size: Double;
    property Bold, Italic, Strikethrough, ColorIsAuto: Boolean;
    property Underline: TXLSXUnderline;
    property Color: LongWord;
    property VertAlign: TXLSXFontVertAlign;
  end;

Membros principais

AddRun and AddRunTextAnexa um trecho vazio ou um trecho com texto inicial
PlainTextRetorna o texto concatenado sem informações de estilo
Name, Size, Bold, Italic and StrikethroughFamília, tamanho e atributos básicos da fonte para um trecho
Underline, Color and ColorIsAutoOpções de sublinhado e cor do trecho
VertAlignAlinhamento vertical de linha de base, subscrito ou sobrescrito

Exemplo

var Rich: TXLSXRichText;
begin
  Rich := TXLSXRichText.Create;
  Rich.AddRunText('Quarterly ');
  Rich.AddRunText('Report').Bold := True;
  Sheet.Cells[1, 1].RichText := Rich;
end;

Veja também