[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.ITables.Add

Add Method

Add(IRange, bool)

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.

Declaration
ITable Add(IRange range, bool containsHeader = false)
Function Add(range As IRange, Optional containsHeader As Boolean = False) As ITable
Parameters
Type Name Description
IRange range

The cell range to include in the table; must not be null.

bool containsHeader true if the first row of the range contains header cells; otherwise, false.
Returns
Type Description
ITable

The newly created ITable object.

Examples
IRange range = worksheet.Range["A1:B3"];
range.Value = new object[,] {
    {"Name", "Value"},
    {"Apple", 100},
    {"Pear", 200}
};
ITable table = worksheet.Tables.Add(range, true);
Exceptions
Type Condition
ArgumentNullException

if range is null.