[]
Gets or sets whether column headers are displayed in the PivotTable.
This property indicates whether the PivotTable shows its column header area using the current table style settings.
bool ShowTableStyleColumnHeaders { get; set; }
Property ShowTableStyleColumnHeaders As Boolean
worksheet.Range["A1:D5"].Value = new object[,] {
{"Category", "Product", "Amount", "Region"},
{"Beverages", "Tea", 100, "East"},
{"Beverages", "Coffee", 200, "West"},
{"Snacks", "Chips", 150, "East"},
{"Snacks", "Nuts", 120, "West"}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:D5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["F1"], "SalesPivot");
pivotTable.PivotFields["Category"].Orientation = PivotFieldOrientation.ColumnField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
bool showColumnHeaders = pivotTable.ShowTableStyleColumnHeaders;