New to Telerik UI for WinForms? Start a free 30-day trial

Exports a PivotGrid's layout and cell values to an ExcelML workbook.

Definition

Namespace:Telerik.WinControls.UI.Export

Assembly:Telerik.WinControls.PivotGrid.dll

Syntax:

C#
public class PivotExportToExcelML

Inheritance: objectPivotExportToExcelML

Constructors

Creates an exporter for the element owned by the specified PivotGrid control.

C#
public PivotExportToExcelML(RadPivotGrid pivotGrid)
Parameters:pivotGridRadPivotGrid

The control whose layout and values are exported.

Creates an exporter for the specified PivotGrid element.

C#
public PivotExportToExcelML(RadPivotGridElement pivotGrid)
Parameters:pivotGridRadPivotGridElement

The element whose layout and values are exported.

Properties

Gets or sets the fallback background color for regular data cells when rendered styles are not exported.

C#
public Color CellBackColor { get; set; }

Gets the layout mode used by the PivotGrid's column headers during export.

C#
public PivotLayout ColumnsLayoutType { get; }

Gets or sets the fallback font for data and descriptor cells when rendered styles are not exported.

C#
public Font DataCellsFont { get; set; }

Gets or sets the fallback background color for row, column, and aggregate descriptor cells when rendered styles are not exported.

C#
public Color DescriptorsBackColor { get; set; }

Gets or sets whether collapsed row and column groups are expanded while collecting export data.

C#
public bool ExportFlatData { get; set; }

After a successful export, groups expanded for export are restored to their previous collapsed state.

Gets or sets whether export is restricted to the current selection.

C#
public bool ExportSelectionOnly { get; set; }

Rows and columns without selected cells are omitted. The remaining row and column intersections are still included in the export.

Gets or sets whether cell styles are copied from the PivotGrid's rendered elements.

C#
public bool ExportVisualSettings { get; set; }

Gets or sets the fallback background color for grand-total cells when rendered styles are not exported.

C#
public Color GrandTotalsBackColor { get; set; }

Gets or sets the grid-line color setting.

C#
public Color GridLinesColor { get; set; }

The current ExcelML renderer uses a separate internal color, so assigning this property does not change exported grid lines.

Gets or sets the fallback font for row and column header cells when rendered styles are not exported.

C#
public Font HeaderCellsFont { get; set; }

Gets or sets the header-background color setting.

C#
public Color HeadersBackColor { get; set; }

The current ExcelML renderer uses a separate internal color, so assigning this property does not change exported header backgrounds.

Gets the layout mode used by the PivotGrid's row headers during export.

C#
public PivotLayout RowsLayoutType { get; }

Gets or sets the maximum number of rows per sheet.

C#
[CLSCompliant(false)]
public ExcelMaxRows SheetMaxRows { get; set; }
Property Value:

The sheet max rows.

Gets or sets the base name used for worksheets created in the exported workbook.

C#
public string SheetName { get; set; }

Gets or sets whether grid lines are included in exported cell borders.

C#
public bool ShowGridLines { get; set; }

Gets or sets the fallback background color for subtotal cells when rendered styles are not exported.

C#
public Color SubTotalsBackColor { get; set; }

Methods

Invokes the PivotExcelCellFormatting handlers with the supplied sender and cell data.

C#
public void CallOnExportCellFormatting(object sender, ExcelPivotCellExportingEventArgs e)
Parameters:senderobject

The object passed to the formatting handlers.

eExcelPivotCellExportingEventArgs

The cell data passed to the formatting handlers.

Creates the descriptor cell for an aggregate field.

C#
protected virtual RadPrintElement GetAggregateDescriptorCell(int aggregateIndex)
Parameters:aggregateIndexint

The zero-based index of the aggregate description.

Returns:

RadPrintElement

The print element representing the aggregate descriptor.

Creates the descriptor cell for a column-group field.

C#
protected virtual RadPrintElement GetColumnDescriptorCell(int descriptorIndex)
Parameters:descriptorIndexint

The zero-based index of the column-group description.

Returns:

RadPrintElement

The print element representing the column descriptor.

Creates a print element for the column-header cell at the specified worksheet row and pivot-column position.

C#
protected virtual RadPrintElement GetColumnHeaderCell(int rowIndex, int columnIndex)
Parameters:rowIndexint

The zero-based worksheet row containing the column header.

columnIndexint

The zero-based index of the pivot column in the export.

Returns:

RadPrintElement

The print element representing the column header.

Creates a print element containing the aggregate value for the specified row and column groups.

C#
protected virtual RadPrintElement GetDataCell(int rowIndex, int columnIndex, PivotRowElement visualRow)
Parameters:rowIndexint

The zero-based index of the row group in the export.

columnIndexint

The zero-based index of the column group in the export.

visualRowPivotRowElement

The rendered data row used when copying visual styles, if available.

Returns:

RadPrintElement

The print element representing the aggregate cell.

Selects the print element for a cell at the specified worksheet coordinates.

C#
protected virtual RadPrintElement GetPrintElementForCell(int rowIndex, int columnIndex, PivotRowElement visualRow)
Parameters:rowIndexint

The zero-based row index, including exported headers and descriptors.

columnIndexint

The zero-based column index, including exported row headers and descriptors.

visualRowPivotRowElement

The rendered data row used when copying visual styles, if available.

Returns:

RadPrintElement

The print element for the cell, or null when the coordinates do not map to an exported cell.

Creates the descriptor cell for a row-group field.

C#
protected virtual RadPrintElement GetRowDescriptorCell(int descriptorIndex)
Parameters:descriptorIndexint

The zero-based index of the row-group description.

Returns:

RadPrintElement

The print element representing the row descriptor.

Creates a print element for the row-header cell at the specified row and hierarchy-column positions.

C#
protected virtual RadPrintElement GetRowHeaderCell(int rowIndex, int columnIndex)
Parameters:rowIndexint

The zero-based index of the row group in the export.

columnIndexint

The zero-based position within the row-header columns.

Returns:

RadPrintElement

The print element representing the row header.

Raises the event.

C#
[CLSCompliant(false)]
protected virtual void OnExcelTableCreated(ExcelTableCreatedEventArgs e)
Parameters:eExcelTableCreatedEventArgs

The ExcelTableCreatedEventArgs instance containing the event data.

Creates ExcelML file

C#
public void RunExport(string fileName)
Parameters:fileNamestring

Export file name

Events

Occurs when the excel table is created.

C#
[CLSCompliant(false)]
public event ExcelTableCreatedEventHandler ExcelTableCreated

Occurs before an exported cell is written, allowing its print element and ExcelML data type to be adjusted.

C#
public event PivotExcelCellFormattingEvent PivotExcelCellFormatting