PivotGridOptionsPrint.MergeRowFieldValues Property

Gets or sets whether the values of outer row fields are merged when a pivot grid is printed.

Namespace: DevExpress.XtraPivotGrid

Assembly: DevExpress.PivotGrid.v20.1.Core.dll

Declaration

[DefaultValue(true)]
public bool MergeRowFieldValues { get; set; }
<DefaultValue(True)>
Public Property MergeRowFieldValues As Boolean

Property Value

Type Default Description
Boolean

true

true if the values of outer row fields are merged; otherwise, false.

Property Paths

You can access this nested property as listed below:

Library Object Type Path to MergeRowFieldValues
WinForms Controls PivotGridControl
.OptionsPrint.MergeRowFieldValues
ASP.NET Controls and MVC Extensions ASPxPivotGridExporter
.OptionsPrint.MergeRowFieldValues
MVCxPivotGridExporter
.OptionsPrint.MergeRowFieldValues
MVCxPivotGridExportSettings
.OptionsPrint.MergeRowFieldValues
PivotGridSettings
.SettingsExport.OptionsPrint.MergeRowFieldValues
Reporting XRPivotGrid
.OptionsPrint.MergeRowFieldValues
XRPivotGrid
.OptionsPrint.MergeRowFieldValues

Remarks

If this property is set to true, the field values of outer row fields are merged when a pivot grid is printed (in the same way as the outer field values are displayed in the control on a form). Otherwise, merged cells are split into small cells, and each cell duplicates the value of the original cell.

PivotGrid-Print-MergeRowFieldValues

The MergeRowFieldValues property is used to customize Pivot Grid export settings when data is exported in WYSIWYG export mode. This property is not in effect in data-aware mode. To customize the Pivot Grid export settings when you export data in data-aware mode, use the PivotXlsExportOptions and PivotXlsxExportOptions descendants. See the example below for more details.

To specify whether to merge the neighboring column headers when a pivot grid is printed, use the PivotGridOptionsPrint.MergeColumnFieldValues property. See the example for more details.

Examples

WYSIWYG Mode

The following example illustrates how to disable merged values of outer row fields in the exported Excel document. Use the ExportType property to enable the (WYSIWYG)[xref:DevExpress.Export.ExportType] export mode and set the MergeRowFieldValues property to false.

private void btnExportToWYSIWYG_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e){
    PivotXlsxExportOptions pivotExportOptions = new DevExpress.XtraPivotGrid.PivotXlsxExportOptions();
    pivotExportOptions.ExportType = DevExpress.Export.ExportType.WYSIWYG;
    pivotGridControl1.OptionsPrint.MergeRowFieldValues = false;
    var path = "D:/temp/pivot-grid-data.xlsx";
    pivotGridControl1.ExportToXlsx(path, pivotExportOptions);
}

Data-Aware Mode

When you export data in Excel format, the exporting mechanism does not duplicate values of outer row fields for each child field value in the exported document. To duplicate field value for every empty cell of outer row fields, handle the PivotXlsExportOptions.CustomizeCell event and fill empty cells with the values, as illustrated in the code snippet below. The resulting table looks similar to the table exported in the WYSIWYG mode with the disabled MergeRowFieldValues property.

private void btnExportToDataAware_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
    PivotXlsxExportOptions options = new PivotXlsxExportOptions();
    options.CustomizeCell += options_CustomizeCell;
    options.ExportType = DevExpress.Export.ExportType.DataAware;
    options.AllowCellMerge = DevExpress.Utils.DefaultBoolean.False;
    string path = "D:/temp/pivot-grid-data.xlsx";
    pivotGridControl1.ExportToXlsx(path, options);
}
void options_CustomizeCell(CustomizePivotCellEventArgs e) {
    if (e.ExportArea == PivotExportArea.Row && e.ValueItemInfo.Field != null 
    && e.Value == null && e.ValueItemInfo.Value != null) { 
        e.Value = e.ValueItemInfo.Field.GetValueText(e.ValueItemInfo.Value);
        e.Handled = true;
    }
}
See Also