[]
ITableColumn objects in a specified ITable. Each ITableColumn in the collection represents a column in the table. Use this interface to access table columns by index or name, and to work with the complete set of columns in a table.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Name", "Value"},
{"A", 100},
{"B", 200}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
ITableColumns columns = table.getColumns();
ITableColumn column = columns.get(0);
add()ITableColumn.add(int position) voidadd(int position,
int count) voiddelete(int position,
int count) get(int index) ITableColumn at the specified index.ITableColumn that corresponds to the specified column name.intgetCount()ITableColumn objects in the collection.ITableColumn objects in the collection.Use this method to determine how many columns are currently defined in a table.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Product", "Q1", "Q2"},
{"Apple", 100, 120},
{"Pear", 80, 95}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:C3"), true);
int count = table.getColumns().getCount();
ITableColumn objects in the collection.ITableColumn at the specified index.Use a zero-based index to retrieve a column from the table's column collection.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Product", "Amount"},
{"Apple", 100},
{"Pear", 200}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
ITableColumn column = table.getColumns().get(0);
index - The zero-based index of the table column to retrieve.ITableColumn object at the specified index.ITableColumn that corresponds to the specified column name.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Product", "Amount"},
{"Apple", 100},
{"Pear", 200}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
ITableColumn column = table.getColumns().get("Amount");
name - The column name.ITableColumn object that corresponds to the specified column name.ITableColumn.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Name", "Score"},
{"Alice", 90},
{"Bob", 85}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
ITableColumn column = table.getColumns().add();
column.setName("Region");
ITableColumn.The position is zero-based. The existing column at the specified position is shifted outward.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Name", "Score"},
{"Alice", 90},
{"Bob", 85}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
ITableColumn column = table.getColumns().add(1);
position - The zero-based relative position of the new column. The existing column at this position is shifted outward.The position is zero-based. Existing columns at the specified position are shifted outward to make room for the new columns.
worksheet.getRange("A1:B3").setValue(new Object[][] {
{"Name", "Score"},
{"Alice", 90},
{"Bob", 85}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:B3"), true);
table.getColumns().add(1, 2);
position - The zero-based relative position at which to add the new column(s). Existing columns at this position are shifted outward.count - The number of columns to add.The position parameter is zero-based and is relative to the table. If count exceeds the number of columns available from position, only the remaining columns are deleted.
worksheet.getRange("A1:C3").setValue(new Object[][] {
{"Name", "Q1", "Q2"},
{"Alice", 100, 120},
{"Bob", 90, 110}
});
ITable table = worksheet.getTables().add(worksheet.getRange("A1:C3"), true);
table.getColumns().delete(1, 1);
position - The zero-based relative position of the first column to delete.count - The number of columns to delete.