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
delete |
Deletes all the text in the text frame. |
get |
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. |
get |
Represents the bottom margin, in points, of the text frame. |
get |
Specifies if the text frame contains text. |
get |
Represents the horizontal alignment of the text frame. See |
get |
Represents the horizontal overflow behavior of the text frame. See |
get |
Represents the left margin, in points, of the text frame. |
get |
Represents the angle to which the text is oriented for the text frame. See |
get |
Represents the reading order of the text frame, either left-to-right or right-to-left. See |
get |
Represents the right margin, in points, of the text frame. |
get |
Represents the text that is attached to a shape in the text frame, and properties and methods for manipulating the text. See |
get |
Represents the top margin, in points, of the text frame. |
get |
Represents the vertical alignment of the text frame. See |
get |
Represents the vertical overflow behavior of the text frame. See |
set |
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. |
set |
Represents the bottom margin, in points, of the text frame. |
set |
Represents the horizontal alignment of the text frame. See |
set |
Represents the horizontal overflow behavior of the text frame. See |
set |
Represents the left margin, in points, of the text frame. |
set |
Represents the angle to which the text is oriented for the text frame. See |
set |
Represents the reading order of the text frame, either left-to-right or right-to-left. See |
set |
Represents the right margin, in points, of the text frame. |
set |
Represents the top margin, in points, of the text frame. |
set |
Represents the vertical alignment of the text frame. See |
set |
Represents the vertical overflow behavior of the text frame. See |
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
- horizontalAlignment
- ExcelScript.ShapeTextHorizontalAlignment
Returns
void
setHorizontalOverflow(horizontalOverflow)
Represents the horizontal overflow behavior of the text frame. See ExcelScript.ShapeTextHorizontalOverflow
for details.
setHorizontalOverflow(
horizontalOverflow: ShapeTextHorizontalOverflow
): void;
Parameters
- horizontalOverflow
- ExcelScript.ShapeTextHorizontalOverflow
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
- orientation
- ExcelScript.ShapeTextOrientation
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
- readingOrder
- ExcelScript.ShapeTextReadingOrder
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
- verticalAlignment
- ExcelScript.ShapeTextVerticalAlignment
Returns
void
setVerticalOverflow(verticalOverflow)
Represents the vertical overflow behavior of the text frame. See ExcelScript.ShapeTextVerticalOverflow
for details.
setVerticalOverflow(verticalOverflow: ShapeTextVerticalOverflow): void;
Parameters
- verticalOverflow
- ExcelScript.ShapeTextVerticalOverflow
Returns
void
Office Scripts