Word.ShapeTextOrientation enum

指定形状中文本框架的方向。

注解

[ API 集:WordApiDesktop 1.2 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/45-shapes/manage-shapes-text-boxes.yaml

await Word.run(async (context) => {
  // Sets text frame properties of the first text box in the main document.
  const shape: Word.Shape = context.document.body.shapes.getByTypes([Word.ShapeType.textBox]).getFirstOrNullObject();
  shape.load("textFrame");
  await context.sync();

  if (shape.isNullObject) {
    console.log("No shapes with text boxes found in main document.");
    return;
  }

  const textFrame: Word.TextFrame = shape.textFrame;
  textFrame.verticalAlignment = Word.ShapeTextVerticalAlignment.bottom;
  textFrame.orientation = Word.ShapeTextOrientation.vertical270;
  textFrame.autoSizeSetting = Word.ShapeAutoSize.shapeToFitText;

  console.log("The first text box's text frame properties were updated:", textFrame);
});

字段

eastAsianHorizontalRotated = "EastAsianHorizontalRotated"

垂直文本的特殊版本,其中某些字体显示为旋转。

eastAsianVertical = "EastAsianVertical"

垂直文本的特殊版本,其中某些字体显示为旋转。

horizontal = "Horizontal"

水平文本。

mixed = "Mixed"

使用自动方向的组合。

none = "None"

无方向,例如在新的几何形状中。

vertical = "Vertical"

确定所有文本是否都是垂直方向, (每行都顺时针旋转 90 度) 。

vertical270 = "Vertical270"

确定所有文本是否都是垂直方向, (每行都顺时针旋转 270 度) 。