PowerPoint.TextVerticalAlignment enum

表示 PowerPoint.TextFramePowerPoint.Shape 中的垂直对齐方式。 如果选择其中一个居中选项,则 的内容 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: PowerPoint.ShapeCollection = context.presentation.slides.getItemAt(0).shapes;
  const braces: PowerPoint.Shape = 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.textRange.font.underline = PowerPoint.ShapeFontUnderlineStyle.heavy;
  braces.textFrame.verticalAlignment = PowerPoint.TextVerticalAlignment.middleCentered;
  braces.textFrame.autoSizeSetting = PowerPoint.ShapeAutoSize.autoSizeShapeToFitText;

  return context.sync();
});

字段

bottom = "Bottom"

指定 应 TextFrameShape底部对齐。

bottomCentered = "BottomCentered"

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

middle = "Middle"

指定 应TextFrame居中对齐。Shape

middleCentered = "MiddleCentered"

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

top = "Top"

指定 应 TextFrameShape顶端对齐。

topCentered = "TopCentered"

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