Xceed Workbooks for .NET v1.4 Documentation
TableColumn Class
Members  Example 


Xceed.Workbooks.NET Assembly > Xceed.Workbooks.NET Namespace : TableColumn Class
Represents a column from a Table in a Worksheet.
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

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

Reference

TableColumn Members
Xceed.Workbooks.NET Namespace