ExcelScript.ShapeAutoSize enum

确定允许的自动调整大小的类型。

注解

示例

/**
 * 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 = star.getTextFrame();
  textFrame.getTextRange().setText(value.toString());
  textFrame.setAutoSizeSetting(ExcelScript.ShapeAutoSize.autoSizeShapeToFitText);
}

字段

autoSizeMixed

使用自动调整大小方案的组合。

autoSizeNone

不自动调整大小。

autoSizeShapeToFitText

根据文本调整形状。

autoSizeTextToFitShape

根据形状调整文本。