Back to Devexpress

PivotLayout.MergeTitles Property

officefileapi-devexpress-dot-spreadsheet-dot-pivotlayout-cbd93b07.md

latest6.4 KB
Original Source

PivotLayout.MergeTitles Property

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

Declaration

csharp
bool MergeTitles { get; set; }
vb
Property MergeTitles As Boolean

Property Value

TypeDescription
Boolean

true , to merge cells containing the outer row and column field items, subtotal and grand total labels; otherwise, false.

|

Remarks

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.

View Example

vb
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
csharp
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.

wpf-spreadsheet-pivot-table-api-examples/CS/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableLayoutActions.cs#L62

csharp
// Merge and center cells with labels.
pivotTable.Layout.MergeTitles = true;
#endregion #MergeTitles

winforms-spreadsheet-pivot-table-api/CS/SpreadsheetPivotTableExamples/CodeExamples/PivotTableLayoutActions.cs#L62

csharp
// Merge and center cells with labels.
pivotTable.Layout.MergeTitles = true;
#endregion #MergeTitles

spreadsheet-document-api-pivot-table-examples/CS/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableLayoutActions.cs#L76

csharp
// Merge and center cells with labels.
pivotTable.Layout.MergeTitles = true;
#endregion #MergeTitles

wpf-spreadsheet-pivot-table-api-examples/VB/SpreadsheetWPFPivotTableExamples/CodeExamples/PivotTableLayoutActions.vb#L60

vb
' Merge and center cells with labels.
            pivotTable.Layout.MergeTitles = True
' #End Region ' #MergeTitles

winforms-spreadsheet-pivot-table-api/VB/SpreadsheetPivotTableExamples/CodeExamples/PivotTableLayoutActions.vb#L60

vb
' Merge and center cells with labels.
            pivotTable.Layout.MergeTitles = True
' #End Region ' #MergeTitles

spreadsheet-document-api-pivot-table-examples/VB/SpreadsheetDocServerPivotAPI/CodeExamples/PivotTableLayoutActions.vb#L70

vb
' Merge and center cells with labels.
            pivotTable.Layout.MergeTitles = True
#End Region ' #MergeTitles

See Also

PivotLayout Interface

PivotLayout Members

DevExpress.Spreadsheet Namespace