"Column Filter" in an Excel table
ShowFilter
This property is responsible for applying a filter to every column of Excel table. It is a boolean property. By default, this property is false.
- using(ExcelRange Rng = wsSheet1.Cells["B4:F12"]) {
- ExcelTableCollection tblcollection = wsSheet1.Tables;
- ExcelTable table = tblcollection.Add(Rng, "tblSalesman");
- table.ShowFilter = true;
- }
"Show Header" in an Excel table
This property is responsible for showing the table header in every column of the Excel table. By default, this property is true. It is a boolean property.
- using(ExcelRange Rng = wsSheet1.Cells["B4:F12"]) {
- ExcelTableCollection tblcollection = wsSheet1.Tables;
- ExcelTable table = tblcollection.Add(Rng, "tblSalesman");
- table.ShowHeader = false;
- }
"Show Total" in an Excel Table?
This property is responsible for showing the table footer of Excel table. By default, this property is false. It is a boolean property.
- using(ExcelRange Rng = wsSheet1.Cells["B4:F12"]) {
- ExcelTableCollection tblcollection = wsSheet1.Tables;
- ExcelTable table = tblcollection.Add(Rng, "tblSalesman");
- table.ShowTotal = true;
- }
"Totals Row Formula" & "Total Row Label" in an Excel Table?
These two properties are applied in Excel table footer position & applicable to specific column index. Both properties are of string type.
- TotalRowLabel: Showing a label or text under the excel table footer position.
- TotalRowFormula: Applying SUBTOTAL() function in excel table footer position.
Excel SUBTOTAL() function syntax has the following arguments.
Here, the first argument function_num is defined as specific numbers & these numbers are pointing to a specific mathematical function. See this below table.
function_num function Name
- 101 AVERAGE
- 102 COUNT
- 103 COUNTA
- 104 MAX
- 105 MIN
- 106 PRODUCT
- 107 STDEV
- 108 STDEVP
- 109 SUM
- 110 VAR
- 111 VARP
For more information, please go through this
link.
- using (ExcelRange Rng = wsSheet1.Cells["B4:F12"])
- {
- ExcelTableCollection tblcollection = wsSheet1.Tables;
- ExcelTable table = tblcollection.Add(Rng, "tblSalesman");
-
-
- table.Columns[0].TotalsRowLabel = "Total Rows";
-
-
- table.Columns[1].TotalsRowFormula = "SUBTOTAL(102,[Id])";
- table.Columns[2].TotalsRowFormula = "SUBTOTAL(109,[Sales Amount])";
- table.Columns[3].TotalsRowFormula = "SUBTOTAL(101,[Profits])";
- }
"Totals Row Function" in an Excel Table
TotalsRowFunction: Does the same thing as SUBTOTAL() Excel function, but in this case, we use RowFunctions enum for mathematical function.
- using(ExcelRange Rng = wsSheet1.Cells["B4:F12"]) {
- ExcelTableCollection tblcollection = wsSheet1.Tables;
- ExcelTable table = tblcollection.Add(Rng, "tblSalesman");
-
- table.Columns[0].TotalsRowLabel = "Total Rows";
- table.Columns[1].TotalsRowFunction = RowFunctions.Count;
- table.Columns[2].TotalsRowFunction = RowFunctions.Sum;
- table.Columns[3].TotalsRowFunction = RowFunctions.Average;
- }
"Table Style" in an Excel Table
Applying for predefined colorful themes in Excel table. Here, TableStyles.Dark9 is 59 number in an enumerator list.