Documentazione HotXLS

TXLSXRichText e TXLSXRichTextRun classes

TXLSXRichText stores styled text runs for TXLSXCell.RichText e comment rich text in the XLSX façade

Declarations

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;

Key members

AddRun and AddRunTextAppend an empty run o a run with initial text
PlainTextRestituisce the concatenated text without style information
Name, Size, Bold, Italic and StrikethroughFont family, size e basic style attributes for one run
Underline, Color and ColorIsAutoUnderline e colour choices for the run
VertAlignBaseline, subscript o superscript vertical alignment

Esempio

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

Vedere also