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
Add Adds two richstrings together. You can just use the overloaded "+" operator to contatenate rich strings.
Clone Returns a Deep copy of the Rich string.
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.
Equals Returns true when both richstrings are equal.
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)
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.
GetHashCode Hashcode for this richstring.
GetRuns Internal as it doesn't clone the struct.
IsEmpty Returns true if the string doesn't have text or rich text runs.
Replace Overloaded
Replace(string, string)
Replace(string, string, Boolean)
RightTrim Trims all the whitespace at the end of the string.
RTFRun A run of RTF.
SetFromHtml Overloaded
SetFromHtml(string, TFlxFormat, TCoreExcelFile)
SetFromHtml(string, TFlxFormat, TCoreExcelFile, Boolean)
SetRTFRun Sets one RTF run.
Substring Overloaded
Substring(Integer)
Substring(Integer, Integer)
ToHtml Overloaded
ToHtml(TCoreExcelFile, TFlxFormat, THtmlVersion, THtmlStyle, TEncoding)
ToHtml(TCoreExcelFile, TFlxFormat, THtmlVersion, THtmlStyle, TEncoding, IHtmlFontEvent)
ToString Returns the string without Rich text info.
Trim Trims all the whitespace at the beginning and end of the string.

Operators

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

Properties

Name Description
Item[const index] Returns the character at position index.
Length Length of the RichString.
RTFRunCount Number of RTF runs.
Value Text of the string without formatting. Might be null.