GetColumnsCount
返回当前表格的列数。
语法
expression.GetColumnsCount();
expression - 表示 ApiTable 类的变量。
参数
此方法没有任何参数。
返回值
number
示例
获取 PDF 中表格的列数。
// Find out how many columns a table has in a PDF.
// Create a table, add a column, and display the column count in the first cell in a PDF.
const doc = Api.GetDocument();
const page = doc.GetPage(0);
const table = Api.CreateTable(2, 2);
const countBefore = table.GetColumnsCount();
table.AddColumn();
const countAfter = table.GetColumnsCount();
const paragraph = Api.CreateParagraph();
paragraph.AddText('Columns before: ' + countBefore + ', after adding: ' + countAfter);
table.GetCell(0, 0).GetContent().Push(paragraph);
page.AddObject(table);