跳到主要内容

SetWidth

指定此单元格的首选宽度。

语法​

expression.SetWidth(sType, nValue);

expression - 表示 ApiTableCell 类的变量。

参数​

名称必需/可选数据类型默认值描述
sType必需TableWidth宽度值的类型。
nValue可选number以正整数表示的表格宽度值。

返回值​

boolean

示例​

在 PDF 中为各个表格单元格设置首选宽度。

// Give specific cells a fixed width in a PDF table.

// Create a table and set the first column cells width in a PDF.

const doc = Api.GetDocument();
const page = doc.GetPage(0);

const table = Api.CreateTable(3, 3);
for (let r = 0; r < 3; r++) {
table.GetRow(r).GetCell(0).SetWidth('twips', 5660);
}

page.AddObject(table);