PivotGridOptionsPrint.MergeColumnFieldValues Property
Gets or sets whether the values of outer column fields are merged when a pivot grid is printed.
Namespace: DevExpress.XtraPivotGrid
Assembly: DevExpress.PivotGrid.v19.1.Core.dll
Declaration
[DefaultValue(true)]
[XtraSerializableProperty]
public bool MergeColumnFieldValues { get; set; }
Property Value
Type | Default | Description |
---|---|---|
Boolean | **true** | true if the values of outer column fields are merged; otherwise, false. |
Property Paths
You can access this nested property as listed below:
Library | Object Type | Path to MergeColumnFieldValues |
---|---|---|
WinForms Controls | PivotGridControl |
|
Reporting | XRPivotGrid |
|
ASP.NET Web Forms Controls | ASPxPivotGridExporter |
|
MVCxPivotGridExporter |
|
|
MVCxPivotGridExportSettings |
|
Remarks
If this property is set to true, the field values of outer column 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, so each duplicates a value of the original cell.
Note that the MergeColumnFieldValues property is used to customize Pivot Grid export settings when data is exported in the WYSIWYG export mode. This property is not in effect for the data-aware mode. To customize the Pivot Grid export settings while exporting in data-aware mode, use the PivotXlsExportOptions and PivotXlsxExportOptions descendants.
To specify whether to merge the neighboring row headers when a pivot grid is printed, use the PivotGridOptionsPrint.MergeRowFieldValues property.
Example
When using the PivotGridControl.ExportToXlsx method with the PivotXlsxExportOptions parameter instance and the default DataAware export type, the cells containing field values appear merged.
You cannot use the PivotGridOptionsPrint.MergeRowFieldValues and PivotGridOptionsPrint.MergeColumnFieldValues
properties to disable merging. In fact, values are not inserted in the corresponding cells. If you enable XlExportOptionsBase.RawDataMode, this functionality is disabled and values are included in all cells. However, in this situation, group row formatting does not apply.
To correct this behavior, handle the PivotXlsExportOptions.CustomizeCell event and fill empty cells with the values, as illustrated in the code snippet below. The resulting table looks like the table exported in WYSIWYG mode with the disabled MergeRowFieldValues property.
PivotXlsxExportOptions options = new PivotXlsxExportOptions();
options.CustomizeCell += options_CustomizeCell;
pivotGridControl1.ExportToXlsx(fileName, 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;
}
}