PowerPoint.TextVerticalAlignment enum

Represents the vertical alignment of a PowerPoint.TextFrame in a PowerPoint.Shape. If one the centered options are selected, the contents of the TextFrame will be centered horizontally within the Shape as a group. To change the horizontal alignment of a text, see PowerPoint.ParagraphFormat and PowerPoint.ParagraphHorizontalAlignment.

Remarks

[ API set: PowerPointApi 1.4 ]

Examples

// 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.verticalAlignment = PowerPoint.TextVerticalAlignment.middleCentered;

  return context.sync();
});

Fields

bottom = "Bottom"

Specifies that the TextFrame should be bottom aligned to the Shape.

bottomCentered = "BottomCentered"

Specifies that the TextFrame should be bottom aligned vertically to the Shape. Contents of the TextFrame will be centered horizontally within the Shape.

middle = "Middle"

Specifies that the TextFrame should be center aligned to the Shape.

middleCentered = "MiddleCentered"

Specifies that the TextFrame should be center aligned vertically to the Shape. Contents of the TextFrame will be centered horizontally within the Shape.

top = "Top"

Specifies that the TextFrame should be top aligned to the Shape.

topCentered = "TopCentered"

Specifies that the TextFrame should be top aligned vertically to the Shape. Contents of the TextFrame will be centered horizontally within the Shape.