Search Results for

    Show / Hide Table of Contents

    TRichString Record

    A string cell value with its rich text information. RTFRuns is an array of TRTFRun structures, where each struct identifies a font style for a portion of text. For example, if you have: Value = "Hello" RTFRuns = {FirstChar:1 Font:Font1, FirstChar:3, Font:Font2} "H" (char 0) will be formatted with the specific cell format.

    "el" (chars 1 and 2) will have Font1 "lo" (chars 3 and 4) will have Font2

    Syntax

    Unit: FlexCel.Core

    TRichString = record;

    Methods

    Name Description
    GetRuns Internal as it doesn't clone the struct.
    SetFromHtml Overloaded
    SetFromHtml(string, TFlxFormat, TCoreExcelFile)
    SetFromHtml(string, TFlxFormat, TCoreExcelFile, Boolean)
    Create Overloaded
    Create
    Create(string)
    Create(string, TRTFRunArray)
    Create(string, TFList<TRTFRun>)
    Create(string, TBytes, TCoreExcelFile)
    Create(string, TRichString, Integer)
    CreateWithoutCopy This won't copy the values. Make sure the values are not reused.
    FromHtml Returns a new TRichString from an HTML text. Note that only some tags from HTML are converted, the ones that do not have correspondence on Excel rich text will be discarded.Note: This method is for advanced uses only. Normally you would just use TExcelFile.​Set​Cell​From​Html(​​Integer, Integer, string, Integer)
    RTFRun A run of RTF.
    SetRTFRun Sets one RTF run.
    GetFontForChar Returns the index of the run for the character charIndex in the string. If there is no font for the character, it will return -1.
    ToString Returns the string without Rich text info.
    Substring Overloaded
    Substring(Integer)
    Substring(Integer, Integer)
    Add Adds two richstrings together. You can just use the overloaded "+" operator to contatenate rich strings.
    Trim Trims all the whitespace at the beginning and end of the string.
    RightTrim Trims all the whitespace at the end of the string.
    Replace Overloaded
    Replace(string, string)
    Replace(string, string, Boolean)
    ToHtml Overloaded
    ToHtml(TCoreExcelFile, TFlxFormat, THtmlVersion, THtmlStyle, TEncoding)
    ToHtml(TCoreExcelFile, TFlxFormat, THtmlVersion, THtmlStyle, TEncoding, IHtmlFontEvent)
    Clone Returns a Deep copy of the Rich string.
    Equals Returns true when both richstrings are equal.
    GetHashCode Hashcode for this richstring.
    IsEmpty Returns true if the string doesn't have text or rich text runs.

    Operators

    Name Description
    Addition Adapts the + operator so it can add two instances of this record.
    Implicit Conversion Overloaded
    Implicit conversion from string to TRichString
    Implicit conversion from TRichString to string
    Equality Adapts the = operator so it returns true when both instances have the same values.
    Inequality Adapts the <> operator so it returns true when both instances have different values.

    Properties

    Name Description
    Value Text of the string without formatting. Might be null.
    RTFRunCount Number of RTF runs.
    Length Length of the RichString.
    Item[const index] Returns the character at position index.
    In This Article
    Back to top FlexCel Studio for VCL and FireMonkey v7.24
    © 2002 - 2025 tmssoftware.com