跳到主要内容

SetWidth

设置当前表格单元格的首选宽度。

继承自 ApiTableCellPr.SetWidth

示例

设置当前表格单元格的首选宽度。

// Resize the width of the cell.

// Change the width of the cell.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
paragraph.AddText("All cells are at least 2 inches wide:");
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
let tableCellPr = tableStyle.GetTableCellPr();
tableCellPr.SetWidth("twips", 2880);
table.SetStyle(tableStyle);
doc.Push(table);