跳到主要内容

SetColumnWidth

设置当前表格中指定列(按索引)的宽度。

语法​

expression.SetColumnWidth(columnIndex, width);

expression - 表示 ApiTable 类的变量。

参数​

名称必需/可选数据类型默认值描述
columnIndex必需number从零开始的列索引。
width必需EMU以英制度量单位测量的列宽。

返回值​

EMU | null

示例​

设置文档中表格特定列的宽度。

// Apply a width value measured in English measure units to a single column.

// Create a 3x3 table and widen its first column to 40 millimeters.

let doc = Api.GetDocument();
let table = Api.CreateTable(3, 3);
table.SetWidth("percent", 100);
doc.Push(table);
table.SetColumnWidth(0, Api.MillimetersToEmus(40));