PowerPoint.TextVerticalAlignment enum

表示 PowerPoint.Shape PowerPoint.TextFrame 的垂直对齐方式。 如果选择了一个居中选项,则 的内容 TextFrame 将以组的形式水平居中 Shape 。 若要更改文本的水平对齐方式,请参阅 PowerPoint.ParagraphFormatPowerPoint.ParagraphHorizontalAlignment

注解

[ API 集:PowerPointApi 1.4 ]

示例

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/powerpoint/shapes/shapes.yaml

// This function gets the collection of shapes on the first slide,
// and adds a brace pair, {}, to the collection, while specifying its
// location and size. Then it names the shape, sets its text and font
// color, and centers it inside the braces.
await PowerPoint.run(async (context) => {
  const shapes = context.presentation.slides.getItemAt(0).shapes;
  const braces = shapes.addGeometricShape(PowerPoint.GeometricShapeType.bracePair, {
      left: 100,
      top: 400,
      height: 50,
      width: 150
    });
  braces.name = "Braces";
  braces.textFrame.textRange.text = "Shape text";
  braces.textFrame.textRange.font.color = "purple";
  braces.textFrame.verticalAlignment = PowerPoint.TextVerticalAlignment.middleCentered;

  return context.sync();
});

字段

bottom = "Bottom"

指定 TextFrame 应与 底部对齐 Shape

bottomCentered = "BottomCentered"

指定 TextFrame 应以垂直 Shape方式与 底部对齐。 的内容 TextFrame 将在 内水平居中 Shape

middle = "Middle"

指定 TextFrame 应将 居中与 Shape对齐。

middleCentered = "MiddleCentered"

指定 TextFrame 应与 垂直 Shape居中对齐。 的内容 TextFrame 将在 内水平居中 Shape

top = "Top"

指定 TextFrame 应将 顶部与 Shape对齐。

topCentered = "TopCentered"

指定 TextFrame 应与 垂直对齐的 Shape顶部。 的内容 TextFrame 将在 内水平居中 Shape