[]
• new TableManager(sheet
)
Represents a table manager that can manage all tables in a sheet.
Name | Type | Description |
---|---|---|
sheet |
Worksheet |
The worksheet. |
▸ add(name?
, row?
, column?
, rowCount?
, columnCount?
, style?
): Table
Adds a range table with a specified size to the sheet.
example
//This example adds a table.
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
Name | Type | Description |
---|---|---|
name? |
string |
The table name. |
row? |
number |
The row index. |
column? |
number |
The column index. |
rowCount? |
number |
The row count of the table. |
columnCount? |
number |
The column count of the table. |
style? |
TableTheme |
The style of the table. |
The new table instance.
▸ addFromDataSource(name
, row
, column
, dataSource
, style
): Table
Adds a range table with a specified data source to the sheet.
example
var 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"},
];
activeSheet.tables.addFromDataSource("Table1", 5, 2, source, GC.Spread.Sheets.Tables.TableThemes.dark1);
Name | Type | Description |
---|---|---|
name |
string |
The table name. |
row |
number |
The row index. |
column |
number |
The column index. |
dataSource |
Object |
The data source for the table. |
style |
TableTheme |
The style of the table. |
The new table instance.
▸ all(): Table
[]
Gets all tables of the sheet.
Table
[]
The GC.Spread.Sheets.Tables.Table array of table instances. The array is never null.
▸ find(row
, column
): Table
Gets the table of the specified cell.
example
//This example uses the find method.
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
//button click
$("#button1").click(function () {
var table = activeSheet.tables.find(0,0);
activeSheet.tables.move(table, 3, 3);
});
Name | Type | Description |
---|---|---|
row |
number |
The row index. |
column |
number |
The column index. |
The table instance if the cell belongs to a table; otherwise,
▸ findByName(name
): Table
Gets the table with a specified name.
example
//This example finds the table by name.
var activeSheet = spread.getActiveSheet();
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
// button click
$("#button1").click(function () {
var table = activeSheet.tables.findByName("Table1");
alert(table);
activeSheet.tables.move(table, 3, 3);
});
Name | Type | Description |
---|---|---|
name |
string |
The table name. |
The table instance if the cell belongs to a table; otherwise,
▸ move(table
, row
, column
): void
Changes the table location.
example
var activeSheet = spread.getActiveSheet();
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
// button click
$("#button1").click(function () {
var table = activeSheet.tables.findByName("Table1");
alert(table);
activeSheet.tables.move(table, 3, 3);
});
Name | Type | Description |
---|---|---|
table |
string | Table |
The table instance or the table name. |
row |
number |
The new row index. |
column |
number |
The new column index. |
void
▸ remove(table
, options
): Table
Removes a specified table.
example
var table = activeSheet.tables.find(0,0);
activeSheet.tables.remove(table, GC.Spread.Sheets.Tables.TableRemoveOptions.keepData);
Name | Type | Description |
---|---|---|
table |
Table |
The table instance or the table name. |
options |
TableRemoveOptions |
Specifies what data is kept when removing the table. |
▸ resize(table
, range
): void
Changes the table size.
example
//This example resizes the table.
activeSheet.tables.add("Table1", 0, 0, 3, 3, GC.Spread.Sheets.Tables.TableThemes.dark1);
activeSheet.getCell(0,0).text("Name");
activeSheet.getCell(0,1).text("Value");
activeSheet.getCell(0,2).text("T/F");
activeSheet.getCell(1,0).text("AW");
activeSheet.getCell(1,1).text("5");
activeSheet.getCell(1,2).text("T");
//button click
$("#button1").click(function () {
var table = activeSheet.tables.find(0,0);
activeSheet.tables.resize(table, new GC.Spread.Sheets.Range(0,0,4,4));
});
Name | Type | Description |
---|---|---|
table |
string | Table |
The table or the table name. |
range |
Range |
The new table range. The headers must remain in the same row, and the resulting table range must overlap the original table range. |
void