[]
Adds a new column to the table and returns the created ITableColumn.
If position is -1 or omitted, the column is appended to the end of the table; otherwise, it is inserted at the specified zero-based position.
ITableColumn Add(int position = -1)
Function Add(Optional position As Integer = -1) As ITableColumn
| Type | Name | Description |
|---|---|---|
| int | position | The zero-based position at which to insert the column, or |
| Type | Description |
|---|---|
| ITableColumn | The ITableColumn created at the specified position, or at the end of the table when |
worksheet.Range["A1:B3"].Value = new object[,] {
{"Name", "Score"},
{"Alice", 90},
{"Bob", 85}
};
ITable table = worksheet.Tables.Add(worksheet.Range["A1:B3"], true);
ITableColumn column = table.Columns.Add();
column.Name = "Region";
Adds one or more columns to the table at the specified relative position.
The position is zero-based. Existing columns at the specified position are shifted outward to make room for the new columns.
void Add(int position, int count)
Sub Add(position As Integer, count As Integer)
| Type | Name | Description |
|---|---|---|
| int | position | The zero-based relative position at which to add the new column(s). Existing columns at this position are shifted outward. |
| int | count | The number of columns to add. |
worksheet.Range["A1:B3"].Value = new object[,] {
{"Name", "Score"},
{"Alice", 90},
{"Bob", 85}
};
ITable table = worksheet.Tables.Add(worksheet.Range["A1:B3"], true);
table.Columns.Add(1, 2);