Class RichTextValue

RichTextValue

A stylized text string used to represent cell text. Substrings of the text can have different text styles.

A run is the longest unbroken substring having the same text style. For example, the sentence "This kid has two apples." has four runs: ["This ", "kid ", "has two ", "apples."].

Methods

MethodReturn typeBrief description
copy()RichTextValueBuilderReturns a builder for a Rich Text value initialized with the values of this Rich Text value.
getEndIndex()IntegerGets the end index of this value in the cell.
getRuns()RichTextValue[]Returns the Rich Text string split into an array of runs, wherein each run is the longest possible substring having a consistent text style.
getStartIndex()IntegerGets the start index of this value in the cell.
getText()StringReturns the text of this value.
getTextStyle()TextStyleReturns the text style of this value.
getTextStyle(startOffset, endOffset)TextStyleReturns the text style of the text from startOffset to endOffset.

Detailed documentation

copy()

Returns a builder for a Rich Text value initialized with the values of this Rich Text value.

Return

RichTextValueBuilder — A builder for a Rich Text value.


getEndIndex()

Gets the end index of this value in the cell.

Return

Integer — The end index of this value in the cell.


getRuns()

Returns the Rich Text string split into an array of runs, wherein each run is the longest possible substring having a consistent text style.

Return

RichTextValue[] — An array of runs.


getStartIndex()

Gets the start index of this value in the cell.

Return

Integer — The start index of this value in the cell.


getText()

Returns the text of this value.

Return

String — The text of this value.


getTextStyle()

Returns the text style of this value.

Return

TextStyle — The text style of this value.


getTextStyle(startOffset, endOffset)

Returns the text style of the text from startOffset to endOffset. Offsets are 0 based and relative to the cell's text, with the start offset being inclusive and the end offset being exclusive.

Parameters

NameTypeDescription
startOffsetIntegerThe start offset.
endOffsetIntegerThe end offset.

Return

TextStyle — The text style of the given substring of this value.

Feedback geben zu...