var convert = function (item) {
return item['cost'] + '$';
}
// Add table
var table = activeSheet.tables.add('tableSales', 0, 0, 4, 4);
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, "isMakeMoney1", "fe IsMakeMoney", null, new GC.Spread.Sheets.CellTypes.CheckBox());
table.autoGenerateColumns(false);
for (var i = 0; i < 5; i++){
activeSheet.setColumnWidth(i, 110.0, GC.Spread.Sheets.SheetArea.viewport);
}
table.insertColumns(3, 1);
table.expandBoundRows(true);
table.bind([tableColumn1, tableColumn2, tableColumn3, tableColumn4, tableColumn5], 'sales', data);
第4列Cost左边新增一列table column
插入“Column32”, 第5列就是原来的第4列,名称变成了Column4,期望Cost.