[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.IPivotTable.MergeLabels

MergeLabels Property

MergeLabels

Gets or sets whether the specified PivotTable report uses merged cells for outer-row items, column items, subtotals, and grand total labels.

Use this property to determine whether repeated labels in the PivotTable layout are displayed by merging adjacent cells.

Declaration
bool MergeLabels { get; set; }
Property MergeLabels As Boolean
Examples
worksheet.Range["A1:C5"].Value = new object[,] {
    {"Region", "Product", "Amount"},
    {"East", "Apple", 100},
    {"East", "Pear", 200},
    {"West", "Apple", 150}
};
IPivotCache pivotCache = workbook.PivotCaches.Create(worksheet.Range["A1:C5"]);
IPivotTable pivotTable = worksheet.PivotTables.Add(pivotCache, worksheet.Range["E1"], "SalesPivot");
pivotTable.PivotFields["Region"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Product"].Orientation = PivotFieldOrientation.RowField;
pivotTable.PivotFields["Amount"].Orientation = PivotFieldOrientation.DataField;
pivotTable.MergeLabels = true;
bool mergeLabels = pivotTable.MergeLabels;