跳到主要内容

SetCellMarginTop

指定表格中特定单元格的当前单元格内容顶部 与顶部边框之间应保留的空间量。

语法

expression.SetCellMarginTop(nValue);

expression - 表示 ApiTableCell 类的变量。

参数

名称必需/可选数据类型默认值描述
nValue必需twips如果此值为 <code>null</code>,则使用默认表格单元格上边距,否则使用指定值覆盖当前单元格的表格单元格上边距。

返回值

此方法不返回任何数据。

示例

此示例指定表格中特定单元格的当前单元格内容顶部与顶部边框之间应保留的空间量。

// How to set the cell top margin for the current table cell.

// Specify the top margin value for the ApiTableCell object.

const presentation = Api.GetPresentation();
const slide = presentation.GetSlideByIndex(0);

const table = Api.CreateTable(2, 4);
const row = table.GetRow(0);
const cell = row.GetCell(0);
const content = cell.GetContent();
const paragraph = Api.CreateParagraph();
paragraph.AddText("This is just a sample text.");
content.Push(paragraph);
cell.SetCellMarginTop(720);

slide.RemoveAllObjects();
slide.AddObject(table);