[]
• new Table(name?
, row?
, col?
, rowCount?
, colCount?
, style?
)
Represents a table that can be added in a sheet.
Name | Type | Description |
---|---|---|
name? |
string |
The table name. |
row? |
number |
The table row index. |
col? |
number |
The table column index. |
rowCount? |
number |
The table row count. |
colCount? |
number |
The table column count. |
style? |
TableTheme |
The table style. |
▸ allowAutoExpand(allowAutoExpandState?
): boolean
| Table
Gets or sets the allowAutoExpandState of the table.
example
table.allowAutoExpand();
table.allowAutoExpand(true);
Name | Type |
---|---|
allowAutoExpandState? |
boolean |
boolean
| Table
If there is no allowAutoExpandState set, returns the table allowAutoExpandState; otherwise, returns the table.
▸ autoGenerateColumns(value?
): any
Gets or sets whether to generate columns automatically while binding to a data source.
Name | Type | Description |
---|---|---|
value? |
boolean |
Whether to generate columns automatically while binding to a data source. |
any
If no value is set, returns whether to generate columns automatically while binding to a data source; otherwise, returns the table.
▸ bandColumns(value?
): any
Gets or sets a value that indicates whether to display an alternating column style.
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 |
Whether to display an alternating column style. |
any
If no value is set, returns whether to display an alternating column style; otherwise, returns the table.
▸ bandRows(value?
): any
Gets or sets a value that indicates whether to display an alternating row style.
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 |
Whether to display an alternating row style. |
any
If no value is set, returns whether to display an alternating row style; otherwise, returns the table.
▸ bind(columns
, path?
, dataSource?
): Table
Gets or sets the dataSource and binding columns and path for the table.
Name | Type | Description |
---|---|---|
columns |
TableColumn [] |
The array of table column information with data fields and names. Each item is GC.Spread.Sheets.Tables.TableColumn. |
path? |
string |
- |
dataSource? |
object |
The data source for the table. |
returns the table.
▸ bindColumns(columns
): void
Binds the columns using the specified data fields.
Name | Type | Description |
---|---|---|
columns |
TableColumn [] |
The array of table column information with data fields and names. Each item is GC.Spread.Sheets.Tables.TableColumn. |
void
▸ bindingPath(value?
): any
Gets or sets the binding path for cell-level binding in the table.
Name | Type | Description |
---|---|---|
value? |
string |
The binding path for cell-level binding in the table. |
any
If no value is set, returns the binding path for cell-level binding in the table; otherwise, returns the table.
▸ clearPendingChanges(): void
Clears the dirty status from the current table.
example
table.clearPendingChanges();
void
▸ dataRange(): Range
Gets the cell range for the table data area.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
var drange = sTable.dataRange();
alert(drange.row);
The table data range.
▸ deleteColumns(col
, count
): void
Delete count number columns in the table at the specified table col index.
example
var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
table.deleteColumns(3, 1);
Name | Type | Description |
---|---|---|
col |
number |
The index of the first column to delete, based on table index. |
count |
number |
The number of columns to delete. |
void
▸ deleteRows(row
, count
): void
Deletes the rows in this table at the specified table row index.
example
var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
table.deleteRows(3, 1);
Name | Type | Description |
---|---|---|
row |
number |
The index of the first row to delete, based on table index. |
count |
number |
The number of rows to delete. |
void
▸ expandBoundRows(value?
): any
Gets or sets a value that table expand rows mode in binding case.
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 |
Whether to expand by sheet or table insert/delete rows. |
any
If no value is set, returns whether to expand by sheet or table insert/delete rows; otherwise, returns the table.
▸ filterButtonVisible(tableColumnIndex?
, value?
): any
Gets or sets whether the table column's filter button is displayed.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
sTable.bandColumns(true);
sTable.bandRows(true);
sTable.filterButtonVisible(2, false);
alert(sTable.filterButtonVisible(2));
Name | Type | Description |
---|---|---|
tableColumnIndex? |
number |
The table column index of the filter button. |
value? |
boolean |
Whether the table column's filter button is displayed. |
any
The table column's filter button display state.
If no parameter is set, returns
▸ footerIndex(): number
Gets the footer index in the sheet.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
sTable.showFooter(true);
sTable.setColumnName(4, "SUM");
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
var value = sTable.footerIndex();
alert(value);
number
The footer index.
▸ getColumnFormula(tableColumnIndex
): string
Gets the table footer formula with the specified index.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
sTable.showFooter(true);
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
var value = sTable.getColumnFormula(4);
alert(value);
Name | Type | Description |
---|---|---|
tableColumnIndex |
number |
The column index of the table footer. The index is zero-based. |
string
The table footer formula.
▸ getColumnName(tableColumnIndex
): string
Gets the table header text with the specified table index.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
sTable.showFooter(true);
sTable.setColumnName(4, "SUM");
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
var value = sTable.getColumnName(4);
alert(value);
Name | Type | Description |
---|---|---|
tableColumnIndex |
number |
The column index of the table header. The index is zero-based. |
string
The header text of the specified column by index.
▸ getColumnValue(tableColumnIndex
): string
Gets the table footer value with the specified index.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
sTable.showFooter(true);
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
var value = sTable.getColumnValue(0);
alert(value);
Name | Type | Description |
---|---|---|
tableColumnIndex |
number |
The column index of the table footer. The index is zero-based. |
string
The table footer value.
▸ getDirtyRows(): IRowState
[]
Get array of dirty rows.
The dirty rows collection. The item in array contains three properties, row: specifies table row index, item: specifies data item of current row, originalItem: specifies original data item of the row.
▸ headerIndex(): number
Gets the header index in the sheet.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
var hindex = sTable.headerIndex();
alert(hindex);
number
The header index.
▸ highlightFirstColumn(value?
): any
Gets or sets a value that indicates whether to highlight the first column.
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 |
Whether to highlight the first column. |
any
If no value is set, returns whether to highlight the first column; otherwise, returns the table.
▸ highlightLastColumn(value?
): any
Gets or sets a value that indicates whether to highlight the last column.
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 |
Whether to highlight the last column. |
any
If no value is set, returns whether to highlight the last column; otherwise, returns the table.
▸ insertColumns(col
, count
, isInsertAfter?
): void
Insert count number columns in this table before the specified table col index.
example
var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
table.insertColumns(3, 1);
Name | Type | Description |
---|---|---|
col |
number |
Column index at which to add the new columns, based on table index. |
count |
number |
The number of columns to add. |
isInsertAfter? |
boolean |
Whether insert columns before the specified column index or after. By default, insert before. |
void
▸ insertRows(row
, count
, isInsertAfter?
): void
Insert rows in this table before the specified table row index.
example
var table = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
table.insertRows(3, 1);
Name | Type | Description |
---|---|---|
row |
number |
The index of the starting row to insert, based on table index. |
count |
number |
The number of rows to add. |
isInsertAfter? |
boolean |
Whether insert rows before the specified row index or after. By default, insert before. |
void
▸ name(value?
): any
Gets or sets the table name.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
var tname = sTable.name();
alert(tname);
Name | Type | Description |
---|---|---|
value? |
string |
The table name. |
any
If no value is set, returns the table name; otherwise, returns the table.
▸ range(): Range
Gets the range for the entire table.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableTheme.medium2);
var drange = sTable.range();
alert(drange.row);
The whole table range.
▸ rowFilter(): HideRowFilter
Gets the row filter for the table.
The row filter.
▸ setColumnDataFormula(tableColumnIndex
, formula
): Table
Sets a formula to the table's data range with the specified index.
example
//This example uses a structured reference formula in the table.
activeSheet.tables.add("Table1", 0, 0, 4, 3, GC.Spread.Sheets.Tables.TableTheme.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]");
Name | Type | Description |
---|---|---|
tableColumnIndex |
number |
The column index of the table. The index is zero-based. |
formula |
string |
The data range formula. |
The table.
▸ setColumnFormula(tableColumnIndex
, formula
): Table
Sets the table footer formula with the specified index.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
Name | Type | Description |
---|---|---|
tableColumnIndex |
number |
The column index of the table footer. The index is zero-based. |
formula |
string |
The table footer formula. |
The table.
▸ setColumnName(tableColumnIndex
, name
): Table
Sets the table header text with the specified table index.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
sTable.setColumnName(4, "SUM");
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
Name | Type | Description |
---|---|---|
tableColumnIndex |
number |
The column index of the table header. The index is zero-based. |
name |
string |
The header text. |
The table.
▸ setColumnValue(tableColumnIndex
, value
): Table
Sets the table footer value with the specified index.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
Name | Type | Description |
---|---|---|
tableColumnIndex |
number |
The column index of the table footer. The index is zero-based. |
value |
Object |
The table footer value. |
The table.
▸ showFooter(value?
, isFooterInserted?
): any
Gets or sets a value that indicates whether to display a footer.
example
var sTable = activeSheet.tables.add("table1", 1, 1, 10, 5, GC.Spread.Sheets.Tables.TableThemes.medium2);
sTable.showFooter(true);
//set footer value
sTable.setColumnValue(0, "Total");
//set footer formula
sTable.setColumnFormula(4, "SUM(F3:F11)");
Name | Type | Description |
---|---|---|
value? |
boolean |
Whether to display a footer. |
isFooterInserted? |
boolean |
value decide the way of adding footer, whether insert total row or just override the next row. Remove footer is same. |
any
If no value is set, returns whether to display a footer; otherwise, returns the table.
▸ showHeader(value?
): any
Gets or sets a value that indicates whether to display a header.
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 |
Whether to display a header. |
any
If no value is set, returns whether to display a header; otherwise, returns the table.
▸ showResizeHandle(value?
): any
Gets or sets a value that indicates whether to display the resize handle for table.
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 |
Whether to display the resize handle for table. |
any
If no value is set, returns whether to display the resize handle for table, by default is false; otherwise, returns the table.
▸ style(value?
): any
Gets or sets a style for the table.
Name | Type | Description |
---|---|---|
value? |
TableTheme |
The style for the table. |
any
If no value is set, returns the table style; otherwise, returns the table.
▸ useFooterDropDownList(value?
): any
Gets or sets a value that indicates whether to use the footer dropdown list for a total row.
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 |
Whether to use the footer dropdown list. |
any
If no value is set, returns whether to use the footer dropdown list for a total row, by default is false; otherwise, returns the table.