那就很复杂了,需要您自行监听事件去修改表格的大小来实现,如:
- let sheet = spread.getActiveSheet();
- sheet.tables.add(
- "Table1",
- 0,
- 0,
- 3,
- 3,
- GC.Spread.Sheets.Tables.TableThemes.dark1
- );
- sheet.bind(GC.Spread.Sheets.Events.ValueChanged, function (e, info) {
- if (info.oldValue != null) {
- return;
- }
- let rowRange = {
- row: info.row - 1,
- col: info.col,
- rowCount: 1,
- colCount: 1,
- };
- let colRange = {
- row: info.row,
- col: info.col - 1,
- rowCount: 1,
- colCount: 1,
- };
- let table = sheet.tables.findByName("Table1");
- let tableRange = table.range();
- if (
- tableRange.intersect(
- rowRange.row,
- rowRange.col,
- rowRange.rowCount,
- rowRange.colCount
- )
- ) {
- sheet.tables.resize(
- table,
- new GC.Spread.Sheets.Range(
- tableRange.row,
- tableRange.col,
- tableRange.rowCount + 1,
- tableRange.colCount
- )
- );
- }
- if (
- tableRange.intersect(
- colRange.row,
- colRange.col,
- colRange.rowCount,
- colRange.colCount
- )
- ) {
- sheet.tables.resize(
- table,
- new GC.Spread.Sheets.Range(
- tableRange.row,
- tableRange.col,
- tableRange.rowCount,
- tableRange.colCount + 1
- )
- );
- }
- });
复制代码
|