[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
在线咨询 立即试用
(Showing Draft Content)

GC.Spread.Sheets.Tables.Table

Class: Table

Sheets.Tables.Table

Table of contents

Constructors

Methods

Constructors

constructor

• new Table(name?, row?, col?, rowCount?, colCount?, style?)

表示可以在工作表中添加的表格。

Parameters

Name Type Description
name? string 表格名称。
row? number 表格行索引。
col? number 表格列索引。
rowCount? number 表格行数。
colCount? number 表格列数。
style? string | TableTheme 表格样式或样式名称。

Methods

allowAutoExpand

▸ allowAutoExpand(allowAutoExpandState?): boolean | Table

获取或设置表格的allowAutoExpandState属性。该属性用于控制在工作表中操作数据时,表格是否允许自动调整大小。

example

var activeSheet = spread.getActiveSheet();
var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
console.log(table.allowAutoExpand()); // true
console.log(table.range().rowCount); // 10
activeSheet.setActiveCell(11, 2);
activeSheet.startEdit(true, "Spreadjs");
activeSheet.endEdit();
console.log(table.range().rowCount); // 11
table.allowAutoExpand(false);
console.log(table.allowAutoExpand());
activeSheet.setActiveCell(12, 2);
activeSheet.startEdit(true, "Test");
activeSheet.endEdit();
console.log(table.range().rowCount); // 11

Parameters

Name Type Description
allowAutoExpandState? boolean 表格的自动扩展状态。

Returns

boolean | Table

如果未设置自动扩展状态,则返回表格的自动扩展状态;否则返回表格。


autoGenerateColumns

▸ autoGenerateColumns(value?): any

获取或设置绑定数据源时是否自动生成列。

example

var data = {
    sales: [
        {orderDate: '1/6/2013', item: 'Pencil', units: 95},
        {orderDate: '4/1/2013', item: 'Binder', units: 60},
        {orderDate: '6/8/2013', item: 'Pen Set', units: 16}
    ]
};
var table = sheet.tables.add('tableSales', 0, 0, 5, 1); // 只有1列
var tableColumn1 = new GC.Spread.Sheets.Tables.TableColumn(1, "orderDate", "Order Date", "d/M/yy");
var tableColumn2 = new GC.Spread.Sheets.Tables.TableColumn(2, "item", "Item");
var tableColumn3 = new GC.Spread.Sheets.Tables.TableColumn(3, "units", "Units");

table.autoGenerateColumns(false);
table.bind([tableColumn1, tableColumn2, tableColumn3], 'sales', data);
console.log(table.dataRange().colCount);    // 1

table.autoGenerateColumns(true);
table.bind([tableColumn1, tableColumn2, tableColumn3], 'sales', data);
console.log(table.dataRange().colCount);    // 3

Parameters

Name Type Description
value? boolean 绑定数据源时是否自动生成列。

Returns

any

如果未设置值,则返回绑定数据源时是否自动生成列;否则返回表格。


bandColumns

▸ bandColumns(value?): any

获取或设置是否显示交替列样式。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.bandColumns(true);
sTable.bandRows(true);

Parameters

Name Type Description
value? boolean 是否显示交替列样式。

Returns

any

如果未设置值,则返回是否显示交替列样式;否则返回表格。


bandRows

▸ bandRows(value?): any

获取或设置是否显示交替行样式。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.bandColumns(true);
sTable.bandRows(true);

Parameters

Name Type Description
value? boolean 是否显示交替行样式。

Returns

any

如果未设置值,则返回是否显示交替行样式;否则返回表格。


bind

▸ bind(columns, path?, dataSource?): Table | Promise<Table>

获取或设置表格的数据源、绑定列和路径。

example

var data = {
  name: 'Jones', region: 'East',
  sales: [
    {orderDate: '1/6/2013', item: 'Pencil', units: 95, cost: 1.99, isMakeMoney: true},
    {orderDate: '4/1/2013', item: 'Binder', units: 60, cost: 4.99, isMakeMoney: false},
    {orderDate: '6/8/2013', item: 'Pen Set', units: 16, cost: 15.99, isMakeMoney: false}
  ]
};
var convert = function (item) {
  return item['cost'] + '$';
}
var table = sheet.tables.add('tableSales', 0, 0, 5, 5);
var tableColumn1 = new GC.Spread.Sheets.Tables.TableColumn(1, "orderDate", "Order Date", "d/M/yy");
var tableColumn2 = new GC.Spread.Sheets.Tables.TableColumn(2, "item", "Item");
var tableColumn3 = new GC.Spread.Sheets.Tables.TableColumn(3, "units", "Units");
var tableColumn4 = new GC.Spread.Sheets.Tables.TableColumn(4, "cost", "Cost", null, null, convert);
var tableColumn5 = new GC.Spread.Sheets.Tables.TableColumn(5, "isMakeMoney", "IsMakeMoney", null, new GC.Spread.Sheets.CellTypes.CheckBox());
table.autoGenerateColumns(false);

table.bind([tableColumn1, tableColumn2, tableColumn3, tableColumn4, tableColumn5], 'sales', data);

Parameters

Name Type Description
columns TableColumn[] 包含数据字段和名称的表格列信息数组。每个项目都是 GC.Spread.Sheets.Tables.TableColumn。
path? string 表格中的绑定路径。
dataSource? string | object | Table 表格的数据源。

Returns

Table | Promise<Table>

返回表格。


bindColumns

▸ bindColumns(columns): void

使用指定的数据字段绑定列。

example

var table = sheet.tables.add('tableSales', 0, 0, 5, 2);
var tableColumn1 = new GC.Spread.Sheets.Tables.TableColumn(1, "orderDate", "Order Date", "d/M/yy");
var tableColumn2 = new GC.Spread.Sheets.Tables.TableColumn(2, "item", "Item");
table.bindColumns([tableColumn1, tableColumn2]);

Parameters

Name Type Description
columns TableColumn[] 包含数据字段和名称的表格列信息数组。每个项目都是 GC.Spread.Sheets.Tables.TableColumn。

Returns

void


bindingPath

▸ bindingPath(value?): any

获取或设置表格中单元格级绑定的绑定路径。

Parameters

Name Type Description
value? string 表格中单元格级绑定的绑定路径。

Returns

any

如果未设置值,则返回表格中单元格级绑定的绑定路径;否则返回表格。


clearPendingChanges

▸ clearPendingChanges(): void

清除当前表格的脏数据状态。

example

// 表格绑定数据
var data = {
    sales: [
        {orderDate: '1/6/2013', item: 'Pencil'},
        {orderDate: '4/1/2013', item: 'Binder'},
        {orderDate: '6/8/2013', item: 'Pen Set'}
    ]
};
var table = sheet.tables.add('tableSales', 0, 0, 5, 5);
var tableColumn1 = new GC.Spread.Sheets.Tables.TableColumn(1, "orderDate", "Order Date", "d/M/yy");
var tableColumn2 = new GC.Spread.Sheets.Tables.TableColumn(2, "item", "Item");
table.bind([tableColumn1, tableColumn2], 'sales', data);
sheet.setValue(1, 1, 'dirty data');
console.log(table.getDirtyRows()); // [{row:0, item: ..., originalItem: ...}]

table.clearPendingChanges();
console.log(table.getDirtyRows()); // [ ]

Returns

void


columnLayoutStyle

▸ columnLayoutStyle(tableColumnIndex, value?): Table | ITableLayoutStyle

获取或设置表格列的布局样式。

example

var table = activeSheet.tables.find(0,0);
var dataStyle = new GC.Spread.Sheets.Style();
dataStyle.backColor = "red";
var footerStyle = new GC.Spread.Sheets.Style();
footerStyle.backColor = "green";
var layoutStyle = {};
layoutStyle.data = dataStyle;
layoutStyle.footer = footerStyle;
table.columnLayoutStyle(1, layoutStyle);

Parameters

Name Type Description
tableColumnIndex number 表格列的列索引。索引从零开始。
value? ITableLayoutStyle 布局样式。

Returns

Table | ITableLayoutStyle

如果未设置值,则返回表格列的布局样式;否则返回表格。


dataRange

▸ dataRange(): Range

获取表格数据区域的单元格范围。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
var drange = sTable.dataRange();
alert(drange.row);

Returns

Range

表格数据范围。


deleteColumns

▸ deleteColumns(col, count): void

在指定的表格列索引处删除指定数量的列。

example

var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
table.deleteColumns(3, 1);

Parameters

Name Type Description
col number 要删除的第一列的索引,基于表格索引。
count number 要删除的列数。

Returns

void


deleteRows

▸ deleteRows(row, count): void

删除指定表格行索引处的行。

example

var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
table.deleteRows(3, 1);

Parameters

Name Type Description
row number 要删除的第一行的索引,基于表格索引。
count number 要删除的行数。

Returns

void


expandBoundRows

▸ expandBoundRows(value?): any

获取或设置表格绑定模式下的行扩展模式。

example

var spread = GC.Spread.Sheets.findControl("ss") || GC.Spread.Sheets.findControl("sampleDiv");
var sheet = spread.getActiveSheet();
var data = {
    name: 'Jones', region: 'East',
    sales: [
        { orderDate: '1/6/2013', item: 'Pencil', units: 95, cost: 1.99 },
        { orderDate: '4/1/2013', item: 'Binder', units: 60, cost: 4.99 },
        { orderDate: '6/8/2013', item: 'Pen Set', units: 16, cost: 15.99 },
        { orderDate: '8/1/2013', item: 'Pencil', units: 20, cost: 24.99 },
        { orderDate: '10/8/2013', item: 'Binder', units: 31, cost: 16.99 }
    ]
};
var table1 = sheet.tables.add('tableRecords', 0, 0, 4, 4);
var table2 = sheet.tables.add('tableBelow', 4, 0, 4, 7);
table1.bindingPath('sales');
var dataSource = new GC.Spread.Sheets.Bindings.CellBindingSource(data);
table1.expandBoundRows(true);
sheet.setDataSource(dataSource);

Parameters

Name Type Description
value? boolean 是否通过工作表或表格插入/删除行来扩展。

Returns

any

如果未设置值,则返回是否通过工作表或表格插入/删除行来扩展;否则返回表格。


filterButtonVisible

▸ filterButtonVisible(tableColumnIndex?, value?): any

获取或设置表格列的过滤器按钮是否显示。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.bandColumns(true);
sTable.bandRows(true);
sTable.filterButtonVisible(2, false);
alert(sTable.filterButtonVisible(2));

Parameters

Name Type Description
tableColumnIndex? number | boolean 过滤器按钮的表格列索引。
value? boolean 表格列的过滤器按钮是否显示。

Returns

any

表格列的过滤器按钮显示状态。 如果未设置参数,则返回false,如果所有过滤器按钮都不可见,则返回true。 如果只设置一个数字,则返回指定表格列的过滤器按钮是否显示。 如果只设置一个布尔值,则应用于所有过滤器按钮并返回表格。 如果提供两个参数,则应用于指定表格列的过滤器按钮并返回表格。


footerIndex

▸ footerIndex(): number

获取表格页脚的索引。

example

var sTable = sheet.tables.add("table1", 0, 0, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);

var footerIndex = sTable.footerIndex();
console.log(footerIndex) // 10
// 因为表格的汇总行位于第 11 行。

Returns

number

页脚索引。


getBindingSource

▸ getBindingSource(): null | object | Table

获取表格的绑定源(如果已绑定)。

example

// 如果绑定一个对象
const source = [
                { LastName: "Freehafer", FirstName: "Nancy", Title: "Sales Representative", Phone: "(123)555-0100"},
                { LastName: "Cencini", FirstName: "Andrew", Title: "Vice President, Sales", Phone: "(123)555-0101"},
                { LastName: "Kotas", FirstName: "Jan", Title: "Sales Representative", Phone: "(123)555-0102"},
                { LastName: "Sergienko", FirstName: "Mariya", Title: "Sales Representative", Phone: "(123)555-0103"},
            ];
const table = activeSheet.tables.addFromDataSource("Table1", 5, 2, source, GC.Spread.Sheets.Tables.TableThemes.dark1);
const bindingSource = table.getBindingSource();
// 如果绑定一个数据管理器表格,它将返回该表格
const table = activeSheet.tables.addFromDataSource("Table1", 5, 2, "products", GC.Spread.Sheets.Tables.TableThemes.dark1);
// bindingTable 将是数据管理器表格
const bindingTable = table.getBindingSource();

Returns

null | object | Table

表格绑定源。


getColumnDataField

▸ getColumnDataField(tableColumnIndex): string

获取指定表格列索引的表格列数据字段。

example

table.setColumnDataField(3, "name");
const dataField = table.getColumnDataField(3); // "name"

Parameters

Name Type Description
tableColumnIndex number 表格列的列索引。索引从零开始。

Returns

string

指定表格列的数据字段。


getColumnFormula

▸ getColumnFormula(tableColumnIndex): string

获取指定索引的表格页脚公式。

example

var sTable = sheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
//设置汇总行公式
sTable.setColumnFormula(4, "SUM(F3:F11)");

//获取汇总行公式
var columnFormula = sTable.getColumnFormula(4);
console.log(columnFormula); // "SUM(F3:F11)"

Parameters

Name Type Description
tableColumnIndex number 表格页脚的列索引。索引从零开始。

Returns

string

表格页脚公式。


getColumnName

▸ getColumnName(tableColumnIndex): string

获取指定表格索引的表格标题文本。

example

var sTable = sheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.setColumnName(4, "SUM");

var value = sTable.getColumnName(4);
console.log(value); // "SUM"

Parameters

Name Type Description
tableColumnIndex number 表格标题的列索引。索引从零开始。

Returns

string

指定列索引的表格标题文本。


getColumnValue

▸ getColumnValue(tableColumnIndex): string

获取指定索引的表格页脚值。

example

var sTable = sheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
// 设置页脚值
sTable.setColumnValue(0, "Total");

// 获取页脚值
var value = sTable.getColumnValue(0);
console.log(value) // "Total"

Parameters

Name Type Description
tableColumnIndex number 表格页脚的列索引。索引从零开始。

Returns

string

表格页脚值。


getDirtyRows

▸ getDirtyRows(): IRowState[]

获取脏数据行数组。

example

// 表格绑定数据
var data = {
    sales: [
        {orderDate: '1/6/2013', item: 'Pencil'},
        {orderDate: '4/1/2013', item: 'Binder'},
        {orderDate: '6/8/2013', item: 'Pen Set'}
    ]
};
var table = sheet.tables.add('tableSales', 0, 0, 5, 5);
var tableColumn1 = new GC.Spread.Sheets.Tables.TableColumn(1, "orderDate", "Order Date", "d/M/yy");
var tableColumn2 = new GC.Spread.Sheets.Tables.TableColumn(2, "item", "Item");
table.bind([tableColumn1, tableColumn2], 'sales', data);

console.log(table.getDirtyRows()); // [ ]

sheet.setValue(1, 1, 'dirty data');
console.log(table.getDirtyRows()); // [{row:0, item: ..., originalItem: ...}]

Returns

IRowState[]

脏数据行集合。数组中的项包含三个属性:row:指定表格行索引,item:指定当前行的数据项,originalItem:指定该行的原始数据项。


getSlicerData

▸ getSlicerData(): TableSlicerData

获取表格的切片器数据。

example

var activeSheet = spread.getActiveSheet();
var dataSource = [
    { Name: "Bob", City: "NewYork", Birthday: "1968/6/8" },
    { Name: "Betty", City: "NewYork", Birthday: "1972/7/3" },
    { Name: "Alice", City: "Washington", Birthday: "2012/2/15" },
];
var table = activeSheet.tables.addFromDataSource("table1", 1, 1, dataSource);
var slicerData = table.getSlicerData();
console.log(slicerData instanceof GC.Spread.Sheets.Slicers.TableSlicerData); // true
console.log(table.getSlicerData() === slicerData); // true

Returns

TableSlicerData

表格的切片器数据。


getStyleName

▸ getStyleName(): undefined | string

获取或设置表格的样式名称。

Returns

undefined | string

表格样式名称。


headerIndex

▸ headerIndex(): number

获取表格标题的索引。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
var hindex = sTable.headerIndex();
alert(hindex);

Returns

number

标题索引。


highlightFirstColumn

▸ highlightFirstColumn(value?): any

获取或设置是否突出显示第一列。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.highlightFirstColumn(true);
sTable.highlightLastColumn(true);

Parameters

Name Type Description
value? boolean 是否突出显示第一列。

Returns

any

如果未设置值,则返回是否突出显示第一列;否则返回表格。


highlightLastColumn

▸ highlightLastColumn(value?): any

获取或设置是否突出显示最后一列。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.highlightFirstColumn(true);
sTable.highlightLastColumn(true);

Parameters

Name Type Description
value? boolean 是否突出显示最后一列。

Returns

any

如果未设置值,则返回是否突出显示最后一列;否则返回表格。


insertColumns

▸ insertColumns(col, count, isInsertAfter?): void

在指定的表格列索引之前插入指定数量的列。

example

var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
table.insertColumns(3, 1);

Parameters

Name Type Description
col number 要添加新列的表格列索引,基于表格索引。
count number 要添加的列数。
isInsertAfter? boolean 是否在指定列索引之前插入列。默认情况下,插入到之前。

Returns

void


insertRows

▸ insertRows(row, count, isInsertAfter?): void

在指定的表格行索引之前插入指定数量的行。

example

var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
table.insertRows(3, 1);

Parameters

Name Type Description
row number 要插入的第一行的索引,基于表格索引。
count number 要添加的行数。
isInsertAfter? boolean 是否在指定行索引之前插入行。默认情况下,插入到之前。

Returns

void


layoutStyle

▸ layoutStyle(value?): Table | ITableLayoutStyle

获取或设置表格数据区域的样式。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
var dataStyle = new GC.Spread.Sheets.Style();
dataStyle.backColor = "red";
var footerStyle = new GC.Spread.Sheets.Style();
footerStyle.backColor = "green";
var layoutStyle = {};
layoutStyle.data = dataStyle;
layoutStyle.footer = footerStyle;
table.layoutStyle(layoutStyle);

Parameters

Name Type Description
value? ITableLayoutStyle 一个命名样式或样式实例。

Returns

Table | ITableLayoutStyle

如果未设置值,则返回表格数据区域的样式;否则返回表格。


name

▸ name(value?): any

获取或设置表格名称。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
var tname = sTable.name();
alert(tname);

Parameters

Name Type Description
value? string 表格名称。

Returns

any

如果未设置值,则返回表格名称;否则返回表格。


range

▸ range(): Range

获取表格的整个范围。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
var drange = sTable.range();
alert(drange.row);

Returns

Range

表格的整个范围。


rowFilter

▸ rowFilter(): HideRowFilter

获取表格的行过滤器。

example

var table = sheet.tables.add('table1', 0, 0, 5, 5);

let rowFilter = table.rowFilter();
console.log(rowFilter.range);

Returns

HideRowFilter

行过滤器。


setColumnDataField

▸ setColumnDataField(tableColumnIndex, dataField): Table

设置指定表格列索引的表格列数据字段。

example

let data = {
    name: 'Jones', region: 'East',
    sales: [
        {orderDate: '1/6/2013', item: 'Pencil', units: 95, cost: 1.99, isMakeMoney: true},
        {orderDate: '4/1/2013', item: 'Binder', units: 60, cost: 4.99, isMakeMoney: false},
        {orderDate: '6/8/2013', item: 'Pen Set', units: 16, cost: 15.99, isMakeMoney: false}
    ]
};
let spreadNS = GC.Spread.Sheets;
let table = sheet.tables.add('tableSales', 0, 0, 4, 2);
let tableColumn1 = new spreadNS.Tables.TableColumn(1);
tableColumn1.name("OrderDate");
tableColumn1.dataField("orderDate");
tableColumn1.formatter("d/M/yy");
let tableColumn2 = new spreadNS.Tables.TableColumn(2);
tableColumn2.name("Item");
tableColumn2.dataField("item");
table.bind([tableColumn1, tableColumn2], 'sales', data);

// 更新 tableColumn2 的名称和 dataField
table.setColumnName(1, 'Cost');
table.setColumnDataField(1, 'cost');

Parameters

Name Type Description
tableColumnIndex number 表格列的列索引。索引从零开始。
dataField string 表格列数据字段。

Returns

Table

表格。


setColumnDataFormula

▸ setColumnDataFormula(tableColumnIndex, formula): Table

设置指定索引的表格数据范围公式。

example

// 此示例使用表格中的结构化引用公式。
activeSheet.tables.add("Table1", 0, 0, 4, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Value1");
activeSheet.getCell(0,1).text("Value2");
activeSheet.getCell(0,2).text("Total");
activeSheet.getCell(1,0).text("1");
activeSheet.getCell(2,0).text("2");
activeSheet.getCell(3,0).text("3");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(2,1).text("5");
activeSheet.getCell(3,1).text("5");
activeSheet.tables.findByName("Table1").setColumnDataFormula(2, "=[Value1]*[Value2]");
activeSheet.tables.findByName("Table1").setColumnDataFormula(2, null); // to clear the column data formula

Parameters

Name Type Description
tableColumnIndex number 表格列的列索引。索引从零开始。
formula null | string 数据范围公式。

Returns

Table

表格。


setColumnFormula

▸ setColumnFormula(tableColumnIndex, formula): Table

设置指定索引的表格页脚公式。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
// 设置页脚值
sTable.setColumnValue(0, "Total");
// 设置页脚公式
sTable.setColumnFormula(4, "SUM(F3:F11)");

Parameters

Name Type Description
tableColumnIndex number 表格页脚的列索引。索引从零开始。
formula string 表格页脚公式。

Returns

Table

表格。


setColumnName

▸ setColumnName(tableColumnIndex, name): Table

设置指定表格索引的表格标题文本。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
sTable.setColumnName(4, "SUM");
// 设置页脚值
sTable.setColumnValue(0, "Total");
// 设置页脚公式
sTable.setColumnFormula(4, "SUM(F3:F11)");

Parameters

Name Type Description
tableColumnIndex number 表格标题的列索引。索引从零开始。
name string 表格标题文本。

Returns

Table

表格。


setColumnValue

▸ setColumnValue(tableColumnIndex, value): Table

设置指定索引的表格页脚值。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
// 设置页脚值
sTable.setColumnValue(0, "Total");
// 设置页脚公式
sTable.setColumnFormula(4, "SUM(F3:F11)");

Parameters

Name Type Description
tableColumnIndex number 表格页脚的列索引。索引从零开始。
value Object 表格页脚值。

Returns

Table

表格。


showFooter

▸ showFooter(value?, isFooterInserted?): any

获取或设置表格页脚是否显示。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
//设置页脚值
sTable.setColumnValue(0, "Total");
//设置页脚公式
sTable.setColumnFormula(4, "SUM(F3:F11)");

Parameters

Name Type Description
value? boolean 是否显示页脚。
isFooterInserted? boolean 该值决定显示页脚的方式,是插入总计行还是覆盖下一行。移除页脚的方式相同。

Returns

any

如果未设置值,则返回是否显示页脚;否则返回表格。


showHeader

▸ showHeader(value?): any

获取或设置是否显示表格标题。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showHeader(true);

Parameters

Name Type Description
value? boolean 是否显示表格标题。

Returns

any

如果未设置值,则返回是否显示标题;否则返回表格。


showResizeHandle

▸ showResizeHandle(value?): any

获取或设置是否显示表格的调整大小手柄。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showResizeHandle(true);

Parameters

Name Type Description
value? boolean 是否显示表格的调整大小手柄。

Returns

any

如果未设置值,则返回是否显示表格的调整大小手柄,默认为false;否则返回表格。


style

▸ style(value?): any

获取或设置表格的样式。

Parameters

Name Type Description
value? string | TableTheme 表格的样式或样式名称。

Returns

any

如果未设置值,则返回表格样式;否则返回表格。


useFooterDropDownList

▸ useFooterDropDownList(value?): any

获取或设置是否在总计行使用页脚下拉列表。

example

var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.useFooterDropDownList(true);

Parameters

Name Type Description
value? boolean 是否使用页脚下拉列表。

Returns

any

如果未设置值,则返回是否在总计行使用页脚下拉列表,默认为false;否则返回表格。