Represents text with multiple paragraphs and mixed formatting in a shape.

The formatting of the string is controlled in a similar fashion as it would be in Microsoft Excel. In Excel, the user must select a portion of the text and set the various formatting properties of that selected text.

With the FormattedText, a portion of the text is "selected" by calling either [[getFont]] or [[getFont]]. Formatting properties are then set on the returned [[FormattedTextFont]] and all characters in the font's selection range are given these properties.

Getting the formatting properties of a [[FormattedTextFont]] will return the formatting of the first character in font's selection range.

See

[[WorksheetShapeWithText.text]]

Hierarchy

Hierarchy

  • Base
    • FormattedText

Implements

  • IFormattedItem
  • IChangeInfoContext

Constructors

  • Returns FormattedText

  • Parameters

    • unformattedString: string

    Returns FormattedText

  • Parameters

    • Rest ..._rest: any[]

    Returns FormattedText

Properties

$type: Type
$t: Type
nextHashCode: number

Accessors

  • get verticalAlignment(): VerticalTextAlignment
  • Gets or sets the vertical alignment of the formatted text in the owning shape.

    Throws

    [[InvalidEnumArgumentException]] The specified value is not defined in the [[VerticalTextAlignment]] enumeration.

    Returns VerticalTextAlignment

  • set verticalAlignment(a): void
  • Parameters

    Returns void

Methods

  • Creates a new [[FormattedText]] that is a copy of this one.

    This should be used if the same formatted text needs to be used in multiple shapes. The FormattedText class can only exist as the [[WorksheetShapeWithText.text]] of one shape at a time. If the FormattedText is already the text of a shape, and needs to be set as the text of another shape, clone the FormattedText and set the returned clone as text of the shape.

    The cloned FormattedText only takes its original configuration for this instance. If this instance is cloned and than changed, the clone will not be changed as well; it will remain as it was when it was cloned.

    Returns FormattedText

  • Parameters

    • other: any

    Returns boolean

  • Gets the font which controls the formatting properties in the string from the specified start index to the end of the string.

    If the start index is greater than or equal to the length of the unformatted string, no exception will be thrown. It will be thrown later when one of the formatting properties of the returned [[FormattedTextFont]] is set.

    Throws

    [[ArgumentOutOfRangeException]] 'startIndex' is less than zero.

    Parameters

    • startIndex: number

      The index of the first character the returned font controls.

    Returns FormattedTextFont

  • Gets the font which controls the formatting properties in the string from the specified start index for the specified number of characters.

    If the start index is greater than or equal to the length of the unformatted string, no exception will be thrown. It will be thrown later when one of the formatting properties of the returned [[FormattedTextFont]] is set.

    Throws

    [[ArgumentOutOfRangeException]] 'startIndex' is less than zero.

    Throws

    [[ArgumentOutOfRangeException]] 'length' is less than one. A zero length string cannot be controlled by a formatting font.

    Parameters

    • startIndex: number

      The index of the first character the returned font controls.

    • length: number

      The number of characters after the start index controlled by the returned font.

    Returns FormattedTextFont

  • Returns IEnumerable$1<FormattedTextFont>

  • Returns number

  • Returns Base

  • Gets the paragraph at the specified zero-based index.

    Throws

    [[ArgumentOutOfRangeException]] 'index' is less than zero or greater than or equal to the number of paragraphs in the collection.

    Parameters

    • index: number

      The zero-based index of the paragraph to get.

    Returns FormattedTextParagraph

  • Gets the paragraphs in the formatted text.

    Returns FormattedTextParagraphCollection

  • Returns the string that represents the [[FormattedText]], which is the unformatted string.

    Returns string

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns boolean

  • Parameters

    • a: any
    • b: any

    Returns boolean

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns number

  • Parameters

    • a: any
    • b: any

    Returns boolean