Document Solutions for Excel, .NET Edition | Document Solutions
Features / Table / Create and Delete Tables
In This Topic
    Create and Delete Tables
    In This Topic

    In DsExcel .NET, you can create and delete tables in spreadsheets using the Add method of the ITables interface and the Delete Method of the ITable Interface, 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.

    Copy Code
    //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
    Note: DsExcel also supports defined names, which can be used to name the table. For more information, see Defined Names.