ExcelScript.TextFrame interface

Represents the text frame of a shape object.

Remarks

Examples

/**
 * This script creates a star shape with the value from cell A1.
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the value of A1 from the worksheet named Sheet1.
  const sheet = workbook.getWorksheet("Sheet1");
  const value = sheet.getRange("A1").getValue();

  // Create a Shape object that looks like a 5-pointed star.
  const star = sheet.addGeometricShape(ExcelScript.GeometricShapeType.star5);

  // Set the text of star and make sure the shape fits the text.
  const textFrame: ExcelScript.TextFrame = star.getTextFrame();
  textFrame.getTextRange().setText(value.toString());
  textFrame.setAutoSizeSetting(ExcelScript.ShapeAutoSize.autoSizeShapeToFitText);
}

Methods

deleteText()

Deletes all the text in the text frame.

getAutoSizeSetting()

The automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing.

getBottomMargin()

Represents the bottom margin, in points, of the text frame.

getHasText()

Specifies if the text frame contains text.

getHorizontalAlignment()

Represents the horizontal alignment of the text frame. See ExcelScript.ShapeTextHorizontalAlignment for details.

getHorizontalOverflow()

Represents the horizontal overflow behavior of the text frame. See ExcelScript.ShapeTextHorizontalOverflow for details.

getLeftMargin()

Represents the left margin, in points, of the text frame.

getOrientation()

Represents the angle to which the text is oriented for the text frame. See ExcelScript.ShapeTextOrientation for details.

getReadingOrder()

Represents the reading order of the text frame, either left-to-right or right-to-left. See ExcelScript.ShapeTextReadingOrder for details.

getRightMargin()

Represents the right margin, in points, of the text frame.

getTextRange()

Represents the text that is attached to a shape in the text frame, and properties and methods for manipulating the text. See ExcelScript.TextRange for details.

getTopMargin()

Represents the top margin, in points, of the text frame.

getVerticalAlignment()

Represents the vertical alignment of the text frame. See ExcelScript.ShapeTextVerticalAlignment for details.

getVerticalOverflow()

Represents the vertical overflow behavior of the text frame. See ExcelScript.ShapeTextVerticalOverflow for details.

setAutoSizeSetting(autoSizeSetting)

The automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing.

setBottomMargin(bottomMargin)

Represents the bottom margin, in points, of the text frame.

setHorizontalAlignment(horizontalAlignment)

Represents the horizontal alignment of the text frame. See ExcelScript.ShapeTextHorizontalAlignment for details.

setHorizontalOverflow(horizontalOverflow)

Represents the horizontal overflow behavior of the text frame. See ExcelScript.ShapeTextHorizontalOverflow for details.

setLeftMargin(leftMargin)

Represents the left margin, in points, of the text frame.

setOrientation(orientation)

Represents the angle to which the text is oriented for the text frame. See ExcelScript.ShapeTextOrientation for details.

setReadingOrder(readingOrder)

Represents the reading order of the text frame, either left-to-right or right-to-left. See ExcelScript.ShapeTextReadingOrder for details.

setRightMargin(rightMargin)

Represents the right margin, in points, of the text frame.

setTopMargin(topMargin)

Represents the top margin, in points, of the text frame.

setVerticalAlignment(verticalAlignment)

Represents the vertical alignment of the text frame. See ExcelScript.ShapeTextVerticalAlignment for details.

setVerticalOverflow(verticalOverflow)

Represents the vertical overflow behavior of the text frame. See ExcelScript.ShapeTextVerticalOverflow for details.

Method Details

deleteText()

Deletes all the text in the text frame.

deleteText(): void;

Returns

void

getAutoSizeSetting()

The automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing.

getAutoSizeSetting(): ShapeAutoSize;

Returns

getBottomMargin()

Represents the bottom margin, in points, of the text frame.

getBottomMargin(): number;

Returns

number

getHasText()

Specifies if the text frame contains text.

getHasText(): boolean;

Returns

boolean

getHorizontalAlignment()

Represents the horizontal alignment of the text frame. See ExcelScript.ShapeTextHorizontalAlignment for details.

getHorizontalAlignment(): ShapeTextHorizontalAlignment;

Returns

getHorizontalOverflow()

Represents the horizontal overflow behavior of the text frame. See ExcelScript.ShapeTextHorizontalOverflow for details.

getHorizontalOverflow(): ShapeTextHorizontalOverflow;

Returns

getLeftMargin()

Represents the left margin, in points, of the text frame.

getLeftMargin(): number;

Returns

number

getOrientation()

Represents the angle to which the text is oriented for the text frame. See ExcelScript.ShapeTextOrientation for details.

getOrientation(): ShapeTextOrientation;

Returns

getReadingOrder()

Represents the reading order of the text frame, either left-to-right or right-to-left. See ExcelScript.ShapeTextReadingOrder for details.

getReadingOrder(): ShapeTextReadingOrder;

Returns

getRightMargin()

Represents the right margin, in points, of the text frame.

getRightMargin(): number;

Returns

number

getTextRange()

Represents the text that is attached to a shape in the text frame, and properties and methods for manipulating the text. See ExcelScript.TextRange for details.

getTextRange(): TextRange;

Returns

getTopMargin()

Represents the top margin, in points, of the text frame.

getTopMargin(): number;

Returns

number

getVerticalAlignment()

Represents the vertical alignment of the text frame. See ExcelScript.ShapeTextVerticalAlignment for details.

getVerticalAlignment(): ShapeTextVerticalAlignment;

Returns

getVerticalOverflow()

Represents the vertical overflow behavior of the text frame. See ExcelScript.ShapeTextVerticalOverflow for details.

getVerticalOverflow(): ShapeTextVerticalOverflow;

Returns

setAutoSizeSetting(autoSizeSetting)

The automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing.

setAutoSizeSetting(autoSizeSetting: ShapeAutoSize): void;

Parameters

autoSizeSetting
ExcelScript.ShapeAutoSize

Returns

void

setBottomMargin(bottomMargin)

Represents the bottom margin, in points, of the text frame.

setBottomMargin(bottomMargin: number): void;

Parameters

bottomMargin

number

Returns

void

setHorizontalAlignment(horizontalAlignment)

Represents the horizontal alignment of the text frame. See ExcelScript.ShapeTextHorizontalAlignment for details.

setHorizontalAlignment(
            horizontalAlignment: ShapeTextHorizontalAlignment
        ): void;

Parameters

Returns

void

setHorizontalOverflow(horizontalOverflow)

Represents the horizontal overflow behavior of the text frame. See ExcelScript.ShapeTextHorizontalOverflow for details.

setHorizontalOverflow(
            horizontalOverflow: ShapeTextHorizontalOverflow
        ): void;

Parameters

Returns

void

setLeftMargin(leftMargin)

Represents the left margin, in points, of the text frame.

setLeftMargin(leftMargin: number): void;

Parameters

leftMargin

number

Returns

void

setOrientation(orientation)

Represents the angle to which the text is oriented for the text frame. See ExcelScript.ShapeTextOrientation for details.

setOrientation(orientation: ShapeTextOrientation): void;

Parameters

Returns

void

setReadingOrder(readingOrder)

Represents the reading order of the text frame, either left-to-right or right-to-left. See ExcelScript.ShapeTextReadingOrder for details.

setReadingOrder(readingOrder: ShapeTextReadingOrder): void;

Parameters

Returns

void

setRightMargin(rightMargin)

Represents the right margin, in points, of the text frame.

setRightMargin(rightMargin: number): void;

Parameters

rightMargin

number

Returns

void

setTopMargin(topMargin)

Represents the top margin, in points, of the text frame.

setTopMargin(topMargin: number): void;

Parameters

topMargin

number

Returns

void

setVerticalAlignment(verticalAlignment)

Represents the vertical alignment of the text frame. See ExcelScript.ShapeTextVerticalAlignment for details.

setVerticalAlignment(
            verticalAlignment: ShapeTextVerticalAlignment
        ): void;

Parameters

Returns

void

setVerticalOverflow(verticalOverflow)

Represents the vertical overflow behavior of the text frame. See ExcelScript.ShapeTextVerticalOverflow for details.

setVerticalOverflow(verticalOverflow: ShapeTextVerticalOverflow): void;

Parameters

Returns

void