officefileapi-devexpress-dot-spreadsheet-dot-pivotlayout-cbd93b07.md
Gets or sets a value indicating whether to merge and center cells containing item labels for the outer row and column fields, subtotal and grand total captions.
Namespace : DevExpress.Spreadsheet
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
bool MergeTitles { get; set; }
Property MergeTitles As Boolean
| Type | Description |
|---|---|
| Boolean |
true , to merge cells containing the outer row and column field items, subtotal and grand total labels; otherwise, false.
|
The example below demonstrates how to use the MergeTitles property to merge cells containing item labels for the outer row and column fields, subtotal and grand total labels. By default, cells with the outer field items have a left-justify alignment and are displayed at the top of the item group.
Dim worksheet As Worksheet = workbook.Worksheets("Report4")
workbook.Worksheets.ActiveWorksheet = worksheet
' Access the pivot table by its name in the collection.
Dim pivotTable As PivotTable = worksheet.PivotTables("PivotTable1")
' Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular)
' Merge and center cells with labels.
pivotTable.Layout.MergeTitles = True
Worksheet worksheet = workbook.Worksheets["Report4"];
workbook.Worksheets.ActiveWorksheet = worksheet;
// Access the pivot table by its name in the collection.
PivotTable pivotTable = worksheet.PivotTables["PivotTable1"];
// Display the pivot table in the tabular form.
pivotTable.Layout.SetReportLayout(PivotReportLayout.Tabular);
// Merge and center cells with labels.
pivotTable.Layout.MergeTitles = true;
The following image illustrates the result of code execution. Item labels for the outer row field, grand total and subtotal captions are centered within the merged cells. Note that the MergeTitles property is in effect for the outer row items only when a pivot table is shown in tabular form.
The following code snippets (auto-collected from DevExpress Examples) contain references to the MergeTitles property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
// Merge and center cells with labels.
pivotTable.Layout.MergeTitles = true;
#endregion #MergeTitles
// Merge and center cells with labels.
pivotTable.Layout.MergeTitles = true;
#endregion #MergeTitles
// Merge and center cells with labels.
pivotTable.Layout.MergeTitles = true;
#endregion #MergeTitles
' Merge and center cells with labels.
pivotTable.Layout.MergeTitles = True
' #End Region ' #MergeTitles
' Merge and center cells with labels.
pivotTable.Layout.MergeTitles = True
' #End Region ' #MergeTitles
' Merge and center cells with labels.
pivotTable.Layout.MergeTitles = True
#End Region ' #MergeTitles
See Also