Skip to main content

MVCxPivotGridExportSettings.CustomExportCell Property

Enables you to specify a different content for individual cells, if the PivotGrid is exported in the WYSIWYG mode.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.2.dll

Declaration

public EventHandler<WebCustomExportCellEventArgs> CustomExportCell { get; set; }

Property Value

Type Description
EventHandler<WebCustomExportCellEventArgs>

A delegate method allowing you to implement custom processing.

Property Paths

You can access this nested property as listed below:

Object Type Path to CustomExportCell
PivotGridSettings
.SettingsExport .CustomExportCell

Remarks

The CustomExportCell event occurs for each cell when the PivotGrid is being exported in WYSIWYG mode, exported to PDF or printed. You can handle this event to change the cell’s appearance and contents in a printed document.

Note

The complete sample project How to obtain the appointment, resource or time interval selected by an end-user is available in the DevExpress Examples repository.

settings.SettingsExport.CustomExportCell = (sender, e) =>
{

    // Determine whether the cell is Grand Total.
    if ((e.ColumnField == null) || (e.RowField == null))
    {
        // Specify the text to display in a cell.
        ((DevExpress.XtraPrinting.TextBrick)e.Brick).Text = string.Format(
             "=> {0}",
             ((DevExpress.XtraPrinting.TextBrick)e.Brick).Text);
        // Specify the colors used to paint the cell.
        e.Appearance.BackColor = Color.Gray;
        e.Appearance.ForeColor = Color.Orange;
        return;
    }

    MVCxPivotGrid pivot = ((MVCxPivotGridExporter)sender).PivotGrid as MVCxPivotGrid;
    int lastRowFieldIndex = pivot.Fields.GetVisibleFieldCount(PivotArea.RowArea) - 1;
    int lastColumnFieldIndex = pivot.Fields.GetVisibleFieldCount(PivotArea.ColumnArea) - 1;

    // Determine whether the cell is an ordinary cell.
    if (e.RowField.AreaIndex == lastRowFieldIndex && e.ColumnField.AreaIndex == lastColumnFieldIndex)
    {
        e.Appearance.ForeColor = Color.Gray;
    }
    // The cell is a Total cell.
    else
    {
        e.Appearance.BackColor = Color.DarkOliveGreen;
        e.Appearance.ForeColor = Color.White;
    }
};

Tip

The CustomExportCell and MVCxPivotGridExportSettings.CustomExportFieldValue events are not in effect during the export in Data-Aware mode. To customize cells in Data-Aware export mode, use the PivotXlsExportOptions.CustomizeCell and PivotXlsxExportOptions.CustomizeCell events.

See Also