[]
Creates a table that includes the specified range of cells.
Use this method to convert a worksheet range into a table. Set
containsHeader to true when the first row in the range
should be used as the table header row.
ITable Add(IRange range, bool containsHeader = false)
Function Add(range As IRange, Optional containsHeader As Boolean = False) As ITable
| Type | Name | Description |
|---|---|---|
| IRange | range | The cell range to include in the table; must not be |
| bool | containsHeader |
true
if the first row of the range contains header cells; otherwise, false.
|
| Type | Description |
|---|---|
| ITable | The newly created ITable object. |
IRange range = worksheet.Range["A1:B3"];
range.Value = new object[,] {
{"Name", "Value"},
{"Apple", 100},
{"Pear", 200}
};
ITable table = worksheet.Tables.Add(range, true);
| Type | Condition |
|---|---|
| ArgumentNullException | if |