跳到主要内容

SetAlignVertical

设置当前单元格范围中文本的垂直对齐方式。

语法

expression.SetAlignVertical(sAligment);

expression - 表示 ApiRange 类的变量。

参数

名称必需/可选数据类型默认值描述
sAligment必需'center' | 'bottom' | 'top' | 'distributed' | 'justify'将应用于单元格内容的垂直对齐方式。

返回值

boolean

示例

在电子表格中的单元格范围内垂直对齐文本。

// How do I position text at the top, middle, or bottom of cells in a spreadsheet?

// Control where content sits within the height of each cell in a spreadsheet.

let worksheet = Api.GetActiveSheet();
let range = worksheet.GetRange("A1:D5");
worksheet.GetRange("A2").SetValue("This is just a sample text distributed in the A2 cell.");
range.SetAlignVertical("distributed");