GetParentTableCell
返回包含当前内容控件的表格单元格。
语法
expression.GetParentTableCell();
expression - 表示 ApiBlockLvlSdt 类的变量。
参数
此方法没有任何参数。
返回值
ApiTableCell | null
示例
查找文档中包含内容控件的表格单元格。
// How do I access the table cell that holds a content control in a document?
// Place a content control inside a table cell and then apply a border to that cell in a document.
let doc = Api.GetDocument();
let tableStyle = doc.CreateStyle("CustomTableStyle", "table");
tableStyle.SetBasedOn(doc.GetStyle("Bordered"));
let table = Api.CreateTable(3, 3);
table.SetStyle(tableStyle);
doc.Push(table);
let blockLvlSdt = Api.CreateBlockLvlSdt();
blockLvlSdt.GetContent().GetElement(0).AddText("This is a block text content control.");
let cell = table.GetRow(0).GetCell(0);
cell.AddElement(0, blockLvlSdt);
let parentTableCell = blockLvlSdt.GetParentTableCell();
parentTableCell.SetCellBorderTop("single", 32, 0, 51, 51, 51);