[]
        
(Showing Draft Content)

Create and Delete Tables

In GcExcel .NET, you can create and delete tables in spreadsheets using the ITables.Add of the ITables and the ITable.Delete of the ITable , or simply transform a cell range into a table by specifying the existing data lying in a worksheet.

Refer to the following example code to create and delete tables in a worksheet.

//Create workbook and access its first worksheet
Workbook workbook = new Workbook();
IWorksheet worksheet = workbook.Worksheets[0];
//Add first table
ITable table1 = worksheet.Tables.Add(worksheet.Range["A1:E5"], true);
//Add second table
ITable table2 = worksheet.Tables.Add(worksheet.Range["F1:G5"], true);
//Delete second Table
worksheet.Tables[1].Delete();

Note: GcExcel also supports defined names, which can be used to name the table. For more information, see Defined Names.