跳到主要内容

SetVerticalAlign

指定当前表格单元格内文本的垂直对齐方式。

语法

expression.SetVerticalAlign(sType);

expression - 表示 ApiTableCell 类的变量。

参数

名称必需/可选数据类型默认值描述
sType必需VerticalTextAlign垂直对齐类型。

返回值

此方法不返回任何数据。

示例

在演示文稿中将文本对齐到表格单元格的底部、中间或顶部。

// How do I position text vertically in a table cell in a presentation?

// Adjust the vertical alignment of text within a cell in a table in a presentation.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);

const table = Api.CreateTable(2, 4);
const row = table.GetRow(1);
row.SetHeight(30 * 36000);
const cell = row.GetCell(0);
const content = cell.GetContent();
const paragraph = Api.CreateParagraph();
paragraph.AddText("This is just a sample text.");
content.Push(paragraph);
cell.SetVerticalAlign("bottom");

slide.RemoveAllObjects();
slide.AddObject(table);