[]
• new Table(name?, row?, col?, rowCount?, colCount?, style?)
表示可以在工作表中添加的表格。
| Name | Type | Description |
|---|---|---|
name? |
string |
表格名称。 |
row? |
number |
表格行索引。 |
col? |
number |
表格列索引。 |
rowCount? |
number |
表格行数。 |
colCount? |
number |
表格列数。 |
style? |
string | TableTheme |
表格样式或样式名称。 |
▸ 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
| Name | Type | Description |
|---|---|---|
allowAutoExpandState? |
boolean |
表格的自动扩展状态。 |
boolean | Table
如果未设置自动扩展状态,则返回表格的自动扩展状态;否则返回表格。
▸ 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
| Name | Type | Description |
|---|---|---|
value? |
boolean |
绑定数据源时是否自动生成列。 |
any
如果未设置值,则返回绑定数据源时是否自动生成列;否则返回表格。
▸ 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);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否显示交替列样式。 |
any
如果未设置值,则返回是否显示交替列样式;否则返回表格。
▸ 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);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否显示交替行样式。 |
any
如果未设置值,则返回是否显示交替行样式;否则返回表格。
▸ 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);
| Name | Type | Description |
|---|---|---|
columns |
TableColumn[] |
包含数据字段和名称的表格列信息数组。每个项目都是 GC.Spread.Sheets.Tables.TableColumn。 |
path? |
string |
表格中的绑定路径。 |
dataSource? |
string | object | Table |
表格的数据源。 |
返回表格。
▸ 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]);
| Name | Type | Description |
|---|---|---|
columns |
TableColumn[] |
包含数据字段和名称的表格列信息数组。每个项目都是 GC.Spread.Sheets.Tables.TableColumn。 |
void
▸ bindingPath(value?): any
获取或设置表格中单元格级绑定的绑定路径。
| Name | Type | Description |
|---|---|---|
value? |
string |
表格中单元格级绑定的绑定路径。 |
any
如果未设置值,则返回表格中单元格级绑定的绑定路径;否则返回表格。
▸ 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()); // [ ]
void
▸ 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);
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格列的列索引。索引从零开始。 |
value? |
ITableLayoutStyle |
布局样式。 |
如果未设置值,则返回表格列的布局样式;否则返回表格。
▸ 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);
表格数据范围。
▸ 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);
| Name | Type | Description |
|---|---|---|
col |
number |
要删除的第一列的索引,基于表格索引。 |
count |
number |
要删除的列数。 |
void
▸ 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);
| Name | Type | Description |
|---|---|---|
row |
number |
要删除的第一行的索引,基于表格索引。 |
count |
number |
要删除的行数。 |
void
▸ 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);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否通过工作表或表格插入/删除行来扩展。 |
any
如果未设置值,则返回是否通过工作表或表格插入/删除行来扩展;否则返回表格。
▸ 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));
| Name | Type | Description |
|---|---|---|
tableColumnIndex? |
number | boolean |
过滤器按钮的表格列索引。 |
value? |
boolean |
表格列的过滤器按钮是否显示。 |
any
表格列的过滤器按钮显示状态。
如果未设置参数,则返回false,如果所有过滤器按钮都不可见,则返回true。
如果只设置一个数字,则返回指定表格列的过滤器按钮是否显示。
如果只设置一个布尔值,则应用于所有过滤器按钮并返回表格。
如果提供两个参数,则应用于指定表格列的过滤器按钮并返回表格。
▸ 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 行。
number
页脚索引。
▸ 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();
null | object | Table
表格绑定源。
▸ getColumnDataField(tableColumnIndex): string
获取指定表格列索引的表格列数据字段。
example
table.setColumnDataField(3, "name");
const dataField = table.getColumnDataField(3); // "name"
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格列的列索引。索引从零开始。 |
string
指定表格列的数据字段。
▸ 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)"
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格页脚的列索引。索引从零开始。 |
string
表格页脚公式。
▸ 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"
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格标题的列索引。索引从零开始。 |
string
指定列索引的表格标题文本。
▸ 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"
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格页脚的列索引。索引从零开始。 |
string
表格页脚值。
▸ 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: ...}]
脏数据行集合。数组中的项包含三个属性:row:指定表格行索引,item:指定当前行的数据项,originalItem:指定该行的原始数据项。
▸ 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
表格的切片器数据。
▸ getStyleName(): undefined | string
获取或设置表格的样式名称。
undefined | string
表格样式名称。
▸ 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);
number
标题索引。
▸ 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);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否突出显示第一列。 |
any
如果未设置值,则返回是否突出显示第一列;否则返回表格。
▸ 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);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否突出显示最后一列。 |
any
如果未设置值,则返回是否突出显示最后一列;否则返回表格。
▸ 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);
| Name | Type | Description |
|---|---|---|
col |
number |
要添加新列的表格列索引,基于表格索引。 |
count |
number |
要添加的列数。 |
isInsertAfter? |
boolean |
是否在指定列索引之前插入列。默认情况下,插入到之前。 |
void
▸ 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);
| Name | Type | Description |
|---|---|---|
row |
number |
要插入的第一行的索引,基于表格索引。 |
count |
number |
要添加的行数。 |
isInsertAfter? |
boolean |
是否在指定行索引之前插入行。默认情况下,插入到之前。 |
void
▸ 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);
| Name | Type | Description |
|---|---|---|
value? |
ITableLayoutStyle |
一个命名样式或样式实例。 |
如果未设置值,则返回表格数据区域的样式;否则返回表格。
▸ 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);
| Name | Type | Description |
|---|---|---|
value? |
string |
表格名称。 |
any
如果未设置值,则返回表格名称;否则返回表格。
▸ 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);
表格的整个范围。
▸ rowFilter(): HideRowFilter
获取表格的行过滤器。
example
var table = sheet.tables.add('table1', 0, 0, 5, 5);
let rowFilter = table.rowFilter();
console.log(rowFilter.range);
行过滤器。
▸ 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');
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格列的列索引。索引从零开始。 |
dataField |
string |
表格列数据字段。 |
表格。
▸ 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
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格列的列索引。索引从零开始。 |
formula |
null | string |
数据范围公式。 |
表格。
▸ 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)");
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格页脚的列索引。索引从零开始。 |
formula |
string |
表格页脚公式。 |
表格。
▸ 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)");
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格标题的列索引。索引从零开始。 |
name |
string |
表格标题文本。 |
表格。
▸ 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)");
| Name | Type | Description |
|---|---|---|
tableColumnIndex |
number |
表格页脚的列索引。索引从零开始。 |
value |
Object |
表格页脚值。 |
表格。
▸ 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)");
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否显示页脚。 |
isFooterInserted? |
boolean |
该值决定显示页脚的方式,是插入总计行还是覆盖下一行。移除页脚的方式相同。 |
any
如果未设置值,则返回是否显示页脚;否则返回表格。
▸ showHeader(value?): any
获取或设置是否显示表格标题。
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showHeader(true);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否显示表格标题。 |
any
如果未设置值,则返回是否显示标题;否则返回表格。
▸ showResizeHandle(value?): any
获取或设置是否显示表格的调整大小手柄。
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showResizeHandle(true);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否显示表格的调整大小手柄。 |
any
如果未设置值,则返回是否显示表格的调整大小手柄,默认为false;否则返回表格。
▸ style(value?): any
获取或设置表格的样式。
| Name | Type | Description |
|---|---|---|
value? |
string | TableTheme |
表格的样式或样式名称。 |
any
如果未设置值,则返回表格样式;否则返回表格。
▸ useFooterDropDownList(value?): any
获取或设置是否在总计行使用页脚下拉列表。
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.useFooterDropDownList(true);
| Name | Type | Description |
|---|---|---|
value? |
boolean |
是否使用页脚下拉列表。 |
any
如果未设置值,则返回是否在总计行使用页脚下拉列表,默认为false;否则返回表格。