Xceed Workbooks for .NET v3.0 Documentation
Xceed.Workbooks.NET Assembly / Xceed.Workbooks.NET Namespace / TableCollection Class
Members Example


In This Topic
    TableCollection Class
    In This Topic
    Represents a collection of Tables in a Worksheet.  
    Object Model
    TableCollection ClassTable Class
    Syntax
    'Declaration
     
    
    <DefaultMemberAttribute("Item")>
    Public Class TableCollection 
       Inherits WorksheetElement
    'Usage
     
    
    Dim instance As TableCollection
    [DefaultMember("Item")]
    public class TableCollection : WorksheetElement 
    Example
    using( var doc = Workbook.Create( "test.xlsx") )   // Creates a Workbook named “test.xlsx”.
      {
        var worksheetA = workbook.Worksheets[ 0 ];
    
        // Fill cells values.
        worksheetA.Rows[ 4 ].Cells[ 6 ].Value = "Fruits";
        worksheetA.Rows[ 5 ].Cells[ 6 ].Value = "Strawberry";
        worksheetA.Rows[ 6 ].Cells[ 6 ].Value = "Orange";
        worksheetA.Rows[ 7 ].Cells[ 6 ].Value = "Banana";
        worksheetA.Rows[ 8 ].Cells[ 6 ].Value = "Apple";
        worksheetA.Rows[ 4 ].Cells[ 7 ].Value = "Quantity";
        worksheetA.Rows[ 5 ].Cells[ 7 ].Value = 8;
        worksheetA.Rows[ 6 ].Cells[ 7 ].Value = 2;
        worksheetA.Rows[ 7 ].Cells[ 7 ].Value = 3;
        worksheetA.Rows[ 8 ].Cells[ 7 ].Value = 3;
    
        // Creates the formatted table from cell (4,6) to cell (8,7), using a medium theme, with the formatted header row displayed.
        worksheetA.Tables.Add( 4, 6, 8, 7, TableStyle.TableStyleMedium20, true );
    
        // Gets the first table of the Worksheet.
        var firstTable = worksheetA.Tables[ 0 ];
    
        doc.Save();
      }
    Inheritance Hierarchy

    System.Object
       Xceed.Workbooks.NET.WorkbookElement
          Xceed.Workbooks.NET.WorksheetElement
             Xceed.Workbooks.NET.TableCollection

    Public Properties
     NameDescription
    Public PropertyGets the number of Table from the TableCollection.  
    Public PropertyOverloaded. Gets the Table element at the specified Id. The first table starts at 0.  
    Top
    Public Methods
     NameDescription
    Public MethodOverloaded. Adds a new Table to the TableCollection.  
    Public MethodReturns true if the TableCollection contains a Table with the name “tableName”; returns false otherwise.  
    Public Method  
    Public MethodOverloaded. Removes a Table from the TableCollection.  
    Public MethodRemoves a Table from the TableCollection by using an index to identify the Table that needs to be removed.  
    Top
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also