'Declaration
Public Class Table Inherits WorksheetElement
'Usage
Dim instance As Table
public class Table : WorksheetElement
Represents a range of Cells that are independent from the other Cells in the Worksheet & grouped to form a rectangular arrangement of Rows and Columns.
'Declaration
Public Class Table Inherits WorksheetElement
'Usage
Dim instance As Table
public class Table : WorksheetElement
Built-in styles can be used to unify the grouped Cells visually.
Note that a header Row can display filtering options for each Column.
A total Row can also be added; each Cell in that Row will display a formula calculation based on the data in that Column (SUM, AVERAGE, COUNT…).
using( var workbook = Workbook.Create("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 this formatted table and sets some properties. Tables and TableColumns can be accessed by position or name. worksheetA.Tables[ 0 ].ShowFirstColumnFormatting = true; worksheetA.Tables[ 0 ].ShowBandedRows = true; worksheetA.Tables[ 0 ].AutoFilter.ShowFilterButton = false; worksheetA.Tables[ "Table1" ].ShowTotalRow = true; worksheetA.Tables[ "Table1" ].Columns[ "Fruits" ].TotalRowLabel = "TOTAL:"; worksheetA.Tables[ "Table1" ].Columns[ "Quantity" ].TotalRowFunction = TotalRowFunction.Sum; workbook.Save(); }
System.Object
Xceed.Workbooks.NET.WorkbookElement
Xceed.Workbooks.NET.WorksheetElement
Xceed.Workbooks.NET.Table
Name | Description | |
---|---|---|
![]() | AutoFilter | Gets the Table’s AutoFilter. The AutoFilter contains the filtering options that will be used for every column of that table. |
![]() | CellRange | Gets the range of cells that are part of the table. A CellRange contains the top-left and the bottom-right cells of a rectangular selection of cells. |
![]() | Columns | Gets the collection of columns that are part of the Table. When a column has no header content, “Column1” will be used as the column header’s default content; the numbers will be incremented for the next columns without header content, thus filing the second column without header content with “Column2” and so forth. |
![]() | Name | Gets or sets the name of the Table. The default name is “Table1”; the numbers will be incremented for every table without a name, thus naming the second Table without a name “Table2” & so forth. Custom names must start with a letter or an underscore (_), contain only letters or numbers and contain between one and 255 characters. Also note that two tables in the Workbook can not have the same name. |
![]() | ShowBandedColumns | Gets or sets if banded columns are displayed. When set to true, the even columns are formatted differently from the odd columns, which can make the table easier to read. The default setting is false. |
![]() | ShowBandedRows | Gets or sets if banded rows are displayed. When set to true, the even rows are formatted differently from the odd rows, which can make the table easier to read. The default setting is false. |
![]() | ShowFirstColumnFormatting | Gets or sets if the table’s first column is displayed using special formatting. The default setting is false. |
![]() | ShowHeaderRow | Gets or sets if the table’s header row is displayed or not. When it is displayed, the table’s first row uses unique formatting to set it apart from the other rows. The default setting is true. |
![]() | ShowLastColumnFormatting | Gets or sets if the table’s last column is displayed using special formatting. The default setting is false. |
![]() | ShowTotalRow | Gets or sets if the table’s total row is displayed or not. The total row is the row at the end of the table; it displays totals for each column. When set to true, the table’s CellRange will grow by one row. The default setting is false. |
![]() | Style | Gets or sets the Style that is used to format the Table. Many built-in styles can be used but the default style is TableStyleLight9. |
![]() | StyleName | Gets or sets the name of a Custom Style that is applied to the Table. The default value is the string value used by the Style property. |
Name | Description | |
---|---|---|
![]() | GetTypeCode | |
![]() | Resize | Overloaded. Resizes the table with a new CellRange. The top of the table must remain in the same row, the resulting table must contain at least one row of data and the resized table must overlap the original table. |
![]() | ToBoolean | |
![]() | ToByte | |
![]() | ToChar | |
![]() | ToDateTime | |
![]() | ToDecimal | |
![]() | ToDouble | |
![]() | ToInt16 | |
![]() | ToInt32 | |
![]() | ToInt64 | |
![]() | ToSByte | |
![]() | ToSingle | |
![]() | ToString | Overloaded. |
![]() | ToType | |
![]() | ToUInt16 | |
![]() | ToUInt32 | |
![]() | ToUInt64 |
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