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


In This Topic
    TableColumn Class
    In This Topic
    Represents a Column that is located inside a Table.
    Object Model
    TableColumn ClassCell ClassCell Class
    Syntax
    'Declaration
     
    
    Public Class TableColumn 
       Inherits WorksheetElement
    'Usage
     
    
    Dim instance As TableColumn
    public class TableColumn : 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[ 10 ].Value = "Employee";
        worksheetA.Rows[ 5 ].Cells[ 10 ].Value = "Nancy Davolio";
        worksheetA.Rows[ 6 ].Cells[ 10 ].Value = "Margaret Peacock";
        worksheetA.Rows[ 7 ].Cells[ 10 ].Value = "Steven Buchanan";
        worksheetA.Rows[ 8 ].Cells[ 10 ].Value = "Laura Callahan";
        worksheetA.Rows[ 4 ].Cells[ 11 ].Value = "Years of experience";
        worksheetA.Rows[ 5 ].Cells[ 11 ].Value = 12;
        worksheetA.Rows[ 6 ].Cells[ 11 ].Value = 2;
        worksheetA.Rows[ 7 ].Cells[ 11 ].Value = 9;
        worksheetA.Rows[ 8 ].Cells[ 11 ].Value = 7;
        worksheetA.Rows[ 4 ].Cells[ 12 ].Value = "Salary";
        worksheetA.Rows[ 5 ].Cells[ 12 ].Value = 75000;
        worksheetA.Rows[ 6 ].Cells[ 12 ].Value = 41000;
        worksheetA.Rows[ 7 ].Cells[ 12 ].Value = 64000;
        worksheetA.Rows[ 8 ].Cells[ 12 ].Value = 55000;
    
        // Creates the formatted table from cell (4,10) to cell (8,12), using a light theme, with the formatted header row displayed.
        worksheetA.Tables.Add( 4, 10, 8, 12, TableStyle.TableStyleLight14, true );
    
        // Gets this formatted table and sets some properties. Table and TableColumn can be accessed by position or name. 
        worksheetA.Tables[ "Table1" ].ShowTotalRow = true;
        worksheetA.Tables[ "Table1" ].Columns[ "Employee" ].TotalRowLabel = "Avg:";
        worksheetA.Tables[ "Table1" ].Columns[ "Years of experience" ].TotalRowFunction = TotalRowFunction.Average;
        worksheetA.Tables[ "Table1" ].Columns[ "Salary" ].TotalRowFunction = TotalRowFunction.CustomFormula;
        worksheetA.Tables[ "Table1" ].Columns[ "Salary" ].TotalRowFormula = "=AVERAGE(M6:M9)";
            
        doc.Save();
      }
    Inheritance Hierarchy

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

    Public Properties
     NameDescription
    Public Property

    Gets the last Cell in the TableColumn.

     
    Public PropertyGets or sets the TableColumn's name.  
    Public PropertyGets the first Cell in the TableColumn.  
    Public PropertyGets or sets the custom formula used in the TableColumn’s Total Row.  
    Public PropertyGets or sets the built-in formula used in the TableColumn’s Total Row.  
    Public PropertyGets or sets the label associated with the TableColumn’s Total Row.  
    Top
    Supported Frameworks

    .NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.

    .NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.

    See Also