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

Exports a pivot grid through a Spread renderer, with options for worksheet output, layout, and cell styling.

Definition

Namespace:Telerik.WinControls.Export

Assembly:Telerik.WinControls.PivotGrid.dll

Syntax:

C#
public class PivotGridSpreadExport

Inheritance: objectPivotGridSpreadExport

Constructors

Initializes an exporter for the specified pivot grid control.

C#
public PivotGridSpreadExport(RadPivotGrid pivotGrid)
Parameters:pivotGridRadPivotGrid

The control whose grid element supplies the data and layout.

Initializes an exporter for a pivot grid element and copies its current row and column header layouts.

C#
public PivotGridSpreadExport(RadPivotGridElement pivotGrid)
Parameters:pivotGridRadPivotGridElement

The grid element whose data will be exported.

Properties

Gets or sets the color of grid borders.

C#
public Color BorderColor { get; set; }

Gets or sets the background color of cells.

C#
public Color CellBackColor { get; set; }

Gets the layout type of pivot grid column container.

C#
public PivotLayout ColumnsLayoutType { get; set; }

Gets or sets the font of data cells.

C#
public Font DataCellsFont { get; set; }

Gets or sets the background color of descriptor cells.

C#
public Color DescriptorsBackColor { get; set; }

Gets or sets a value indicating whether to export flat data(collapsed rows and columns).

C#
public bool ExportFlatData { get; set; }

Gets or sets the format of the exported file - XLSX, PDF, CSV, TXT or XLS.

C#
public SpreadExportFormat ExportFormat { get; set; }
Property Value:

The file extension.

Gets or sets a value indicating whether to export only selection.

C#
public bool ExportSelectionOnly { get; set; }

Gets or sets a value indicating whether the visual settings should be exported.

C#
public bool ExportVisualSettings { get; set; }
Property Value:

true if visual settings are exported; otherwise, false.

Specifies how the file will be exported: as a new file, a new sheet in existing file or will override a sheet with given name.

C#
public FileExportMode FileExportMode { get; set; }
Property Value:

NewSheetInExistingFile - will add a new sheet to the specified file, if it exists CreateOrOverrideFile - will create/override the specified file CreateOrOverrideSheet - will create/override the specified sheet

Gets or sets the background color of grandtotal cells.

C#
public Color GrandTotalsBackColor { get; set; }

Gets or sets the font of header cells.

C#
public Font HeaderCellsFont { get; set; }

Gets or sets the background color of header cells.

C#
public Color HeadersBackColor { get; set; }

Gets the layout type of pivot grid row container.

C#
public PivotLayout RowsLayoutType { get; set; }

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 name of the sheet.

C#
public string SheetName { get; set; }
Property Value:

The name of the sheet.

Gets or sets a value indicating whether to show grid lines in exported file.

C#
public bool ShowGridLines { get; set; }

Gets or sets the background color of subtotal cells.

C#
public Color SubTotalsBackColor { get; set; }

Methods

Writes the cells in a prepared row to the configured Spread renderer.

C#
protected virtual void AddRowToWorksheet(PivotGridExportRowElement rowElement, int rowIndex)
Parameters:rowElementPivotGridExportRowElement

The row containing the formatted export cells.

rowIndexint

The destination row index in the current worksheet.

Cancels an asynchronous export operation.

C#
public void CancelExportAsync()

Creates the export cell for an aggregate descriptor, using either the grid's visual style or descriptor styling options.

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

The index of the aggregate description.

Returns:

PivotGridSpreadExportCellElement

The cell model for the aggregate heading.

Creates a column-descriptor heading from the field name or the aggregate label.

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

The index of the column descriptor.

Returns:

PivotGridSpreadExportCellElement

The column-descriptor cell model.

Creates a cell for the column-group header at the specified export row and column.

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

The index of the header row in the export layout.

columnIndexint

The index of the column group in the export data.

Returns:

PivotGridSpreadExportCellElement

The column-header cell model.

Creates a cell from the aggregate value at the specified row and column groups and applies its export styling.

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

The index of the row group in the export data.

columnIndexint

The index of the column group in the export data.

visualRowPivotRowElement

The attached visual row used to read cell styling when visual settings are exported.

Returns:

PivotGridSpreadExportCellElement

The data-cell model containing the aggregate value and formatted text.

Classifies text as numeric when it parses as a decimal using the current culture; otherwise classifies it as a string.

C#
protected virtual DataType GetDataTypeFromText(string text)
Parameters:textstring

The text to classify.

Returns:

DataType

Number when parsing succeeds; otherwise, String.

Maps an export coordinate to its descriptor, header, or data-cell model.

C#
protected virtual PivotGridSpreadExportCellElement GetExportElementForCell(int rowIndex, int columnIndex, PivotRowElement visualRow)
Parameters:rowIndexint

The zero-based row index in the export layout.

columnIndexint

The zero-based column index in the export layout.

visualRowPivotRowElement

The visual row used to read cell styling when visual settings are exported.

Returns:

PivotGridSpreadExportCellElement

The cell model for the position, or null when no cell is exported there.

Creates a row-descriptor heading, using individual field names in tabular layout or a single label in compact layout.

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

The index of the row descriptor.

Returns:

PivotGridSpreadExportCellElement

The row-descriptor cell model.

Creates a cell for the row-group header at the specified row and header column.

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

The index of the row group in the export data.

columnIndexint

The index of the row-header column.

Returns:

PivotGridSpreadExportCellElement

The row-header cell model.

Copies font, colors, border, and text orientation from a grid visual element when visual settings are enabled.

C#
protected virtual void GetStylesFromVisualCell(PivotGridSpreadExportCellElement gridVisualElement, LightVisualElement visualCell)
Parameters:gridVisualElementPivotGridSpreadExportCellElement

The export-cell model to style.

visualCellLightVisualElement

The grid visual element whose style is copied.

Finds a visual row- or column-header element at the specified export coordinates.

C#
protected virtual LightVisualElement GetVisualElement(int rowIndex, int columnIndex)
Parameters:rowIndexint

The zero-based row index in the export layout.

columnIndexint

The zero-based column index in the export layout.

Returns:

LightVisualElement

The matching header visual element, or null when the position has no corresponding header element.

Rebuilds the internal row, column, descriptor, and size data used by the next export. Collapsed groups are expanded when ExportFlatData is enabled, and groups outside the selection are omitted when ExportSelectionOnly is enabled.

C#
public virtual void Initialize()

Raises the event.

C#
protected virtual void OnAsyncExportCompleted(AsyncCompletedEventArgs e)
Parameters:eAsyncCompletedEventArgs

The AsyncCompletedEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnAsyncExportProgressChanged(ProgressChangedEventArgs e)
Parameters:eProgressChangedEventArgs

The ProgressChangedEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnCellFormatting(PivotGridSpreadExportCellFormattingEventArgs e)
Parameters:ePivotGridSpreadExportCellFormattingEventArgs

The PivotGridSpreadExportCellFormattingEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnExportCompleted(EventArgs e)
Parameters:eEventArgs

The EventArgs instance containing the event data.

Starts an export operation, in the specified sheet. If such sheet does not exist, it gets created.

C#
public void RunExport(Stream exportStream, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation.

C#
public void RunExport(Stream exportStream, ISpreadExportRenderer exportRenderer)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

Starts an export operation, in the specified sheet. If such sheet does not exist, it gets created.

C#
public void RunExport(string fileName, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:fileNamestring

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation.

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

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

Starts an async export operation, in the specified sheet. If such sheet does not exist, it gets created.

C#
public void RunExportAsync(Stream exportStream, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation that runs in a background thread.

C#
public void RunExportAsync(Stream exportStream, ISpreadExportRenderer exportRenderer)
Parameters:exportStreamStream

The stream where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

Starts an async export operation, in the specified sheet. If such sheet does not exist, it gets created.

C#
public void RunExportAsync(string fileName, ISpreadExportRenderer exportRenderer, string sheetName)
Parameters:fileNamestring

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

sheetNamestring

Name of the sheet.

Starts an export operation that runs in a background thread.

C#
public void RunExportAsync(string fileName, ISpreadExportRenderer exportRenderer)
Parameters:fileNamestring

The file name where data will be exported.

exportRendererISpreadExportRenderer

Instance of ISpreadExportRenderer class.

When the value is numeric and the current culture uses a comma decimal separator, replaces commas in the text with periods.

C#
protected virtual string ValidateExcelCellValue(string text, DataType dataType)
Parameters:textstring

The cell text to validate.

dataTypeDataType

The detected type of the cell value.

Returns:

string

The normalized text, or the original text when no normalization is required.

Creates the export-cell model for each worksheet position, raises CellFormatting, and writes the rows.

C#
protected virtual void WriteCells()

Events

Occurs when an async export operation is completed.

C#
public event AsyncCompletedEventHandler AsyncExportCompleted

Occurs when the progress of an async export operation changes.

C#
public event ProgressChangedEventHandler AsyncExportProgressChanged

Occurs for every cell that is being exported.

C#
public event PivotGridSpreadExportCellFormattingEventHandler CellFormatting

Occurs when the export process completes.

C#
public event EventHandler ExportCompleted
In this article
DefinitionConstructorsPivotGridSpreadExport(RadPivotGrid)PivotGridSpreadExport(RadPivotGridElement)PropertiesBorderColorCellBackColorColumnsLayoutTypeDataCellsFontDescriptorsBackColorExportFlatDataExportFormatExportSelectionOnlyExportVisualSettingsFileExportModeGrandTotalsBackColorHeaderCellsFontHeadersBackColorRowsLayoutTypeSheetMaxRowsSheetNameShowGridLinesSubTotalsBackColorMethodsAddRowToWorksheet(PivotGridExportRowElement, int)CancelExportAsync()GetAggregateDescriptorCell(int)GetColumnDescriptorCell(int)GetColumnHeaderCell(int, int)GetDataCell(int, int, PivotRowElement)GetDataTypeFromText(string)GetExportElementForCell(int, int, PivotRowElement)GetRowDescriptorCell(int)GetRowHeaderCell(int, int)GetStylesFromVisualCell(PivotGridSpreadExportCellElement, LightVisualElement)GetVisualElement(int, int)Initialize()OnAsyncExportCompleted(AsyncCompletedEventArgs)OnAsyncExportProgressChanged(ProgressChangedEventArgs)OnCellFormatting(PivotGridSpreadExportCellFormattingEventArgs)OnExportCompleted(EventArgs)RunExport(Stream, ISpreadExportRenderer, string)RunExport(Stream, ISpreadExportRenderer)RunExport(string, ISpreadExportRenderer, string)RunExport(string, ISpreadExportRenderer)RunExportAsync(Stream, ISpreadExportRenderer, string)RunExportAsync(Stream, ISpreadExportRenderer)RunExportAsync(string, ISpreadExportRenderer, string)RunExportAsync(string, ISpreadExportRenderer)ValidateExcelCellValue(string, DataType)WriteCells()EventsAsyncExportCompletedAsyncExportProgressChangedCellFormattingExportCompleted
Not finding the help you need?
Contact Support