PowerPoint.TextVerticalAlignment enum
表示 PowerPoint.Shape 中 PowerPoint.TextFrame 的垂直对齐方式。 如果选择了一个居中选项,则 的内容 TextFrame
将以组的形式水平居中 Shape
。 若要更改文本的水平对齐方式,请参阅 PowerPoint.ParagraphFormat 和 PowerPoint.ParagraphHorizontalAlignment。
注解
示例
// 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" | 指定 |
bottomCentered = "BottomCentered" | 指定 |
middle = "Middle" | 指定 |
middleCentered = "MiddleCentered" | 指定 |
top = "Top" | 指定 |
topCentered = "TopCentered" | 指定 |