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:
public class PivotGridSpreadExport
Inheritance: objectPivotGridSpreadExport
Constructors
Initializes an exporter for the specified pivot grid control.
public PivotGridSpreadExport(RadPivotGrid pivotGrid)
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.
public PivotGridSpreadExport(RadPivotGridElement pivotGrid)
The grid element whose data will be exported.
Properties
Gets or sets the color of grid borders.
public Color BorderColor { get; set; }
Gets or sets the background color of cells.
public Color CellBackColor { get; set; }
Gets the layout type of pivot grid column container.
public PivotLayout ColumnsLayoutType { get; set; }
Gets or sets the font of data cells.
public Font DataCellsFont { get; set; }
Gets or sets the background color of descriptor cells.
public Color DescriptorsBackColor { get; set; }
Gets or sets a value indicating whether to export flat data(collapsed rows and columns).
public bool ExportFlatData { get; set; }
Gets or sets the format of the exported file - XLSX, PDF, CSV, TXT or XLS.
public SpreadExportFormat ExportFormat { get; set; }
The file extension.
Gets or sets a value indicating whether to export only selection.
public bool ExportSelectionOnly { get; set; }
Gets or sets a value indicating whether the visual settings should be exported.
public bool ExportVisualSettings { get; set; }
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.
public FileExportMode FileExportMode { get; set; }
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.
public Color GrandTotalsBackColor { get; set; }
Gets or sets the font of header cells.
public Font HeaderCellsFont { get; set; }
Gets or sets the background color of header cells.
public Color HeadersBackColor { get; set; }
Gets the layout type of pivot grid row container.
public PivotLayout RowsLayoutType { get; set; }
Gets or sets the maximum number of rows per sheet.
[CLSCompliant(false)]
public ExcelMaxRows SheetMaxRows { get; set; }
The sheet max rows.
Gets or sets the name of the sheet.
public string SheetName { get; set; }
The name of the sheet.
Gets or sets a value indicating whether to show grid lines in exported file.
public bool ShowGridLines { get; set; }
Gets or sets the background color of subtotal cells.
public Color SubTotalsBackColor { get; set; }
Methods
Writes the cells in a prepared row to the configured Spread renderer.
protected virtual void AddRowToWorksheet(PivotGridExportRowElement rowElement, int rowIndex)
The row containing the formatted export cells.
rowIndexintThe destination row index in the current worksheet.
Cancels an asynchronous export operation.
public void CancelExportAsync()
Creates the export cell for an aggregate descriptor, using either the grid's visual style or descriptor styling options.
protected virtual PivotGridSpreadExportCellElement GetAggregateDescriptorCell(int aggregateIndex)
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.
protected virtual PivotGridSpreadExportCellElement GetColumnDescriptorCell(int descriptorIndex)
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.
protected virtual PivotGridSpreadExportCellElement GetColumnHeaderCell(int rowIndex, int columnIndex)
The index of the header row in the export layout.
columnIndexintThe 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.
protected virtual PivotGridSpreadExportCellElement GetDataCell(int rowIndex, int columnIndex, PivotRowElement visualRow)
The index of the row group in the export data.
columnIndexintThe index of the column group in the export data.
visualRowPivotRowElementThe 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.
Maps an export coordinate to its descriptor, header, or data-cell model.
protected virtual PivotGridSpreadExportCellElement GetExportElementForCell(int rowIndex, int columnIndex, PivotRowElement visualRow)
The zero-based row index in the export layout.
columnIndexintThe zero-based column index in the export layout.
visualRowPivotRowElementThe 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.
protected virtual PivotGridSpreadExportCellElement GetRowDescriptorCell(int descriptorIndex)
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.
protected virtual PivotGridSpreadExportCellElement GetRowHeaderCell(int rowIndex, int columnIndex)
The index of the row group in the export data.
columnIndexintThe 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.
protected virtual void GetStylesFromVisualCell(PivotGridSpreadExportCellElement gridVisualElement, LightVisualElement visualCell)
The export-cell model to style.
visualCellLightVisualElementThe grid visual element whose style is copied.
Finds a visual row- or column-header element at the specified export coordinates.
protected virtual LightVisualElement GetVisualElement(int rowIndex, int columnIndex)
The zero-based row index in the export layout.
columnIndexintThe zero-based column index in the export layout.
Returns: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.
public virtual void Initialize()
Raises the event.
protected virtual void OnAsyncExportCompleted(AsyncCompletedEventArgs e)
The AsyncCompletedEventArgs instance containing the event data.
Raises the event.
protected virtual void OnAsyncExportProgressChanged(ProgressChangedEventArgs e)
The ProgressChangedEventArgs instance containing the event data.
Raises the event.
protected virtual void OnCellFormatting(PivotGridSpreadExportCellFormattingEventArgs e)
The PivotGridSpreadExportCellFormattingEventArgs instance containing the event data.
Starts an export operation, in the specified sheet. If such sheet does not exist, it gets created.
public void RunExport(Stream exportStream, ISpreadExportRenderer exportRenderer, string sheetName)
The stream where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
sheetNamestringName of the sheet.
Starts an export operation.
public void RunExport(Stream exportStream, ISpreadExportRenderer exportRenderer)
The stream where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
Starts an export operation, in the specified sheet. If such sheet does not exist, it gets created.
public void RunExport(string fileName, ISpreadExportRenderer exportRenderer, string sheetName)
The file name where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
sheetNamestringName of the sheet.
Starts an export operation.
public void RunExport(string fileName, ISpreadExportRenderer exportRenderer)
The file name where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
Starts an async export operation, in the specified sheet. If such sheet does not exist, it gets created.
public void RunExportAsync(Stream exportStream, ISpreadExportRenderer exportRenderer, string sheetName)
The stream where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
sheetNamestringName of the sheet.
Starts an export operation that runs in a background thread.
public void RunExportAsync(Stream exportStream, ISpreadExportRenderer exportRenderer)
The stream where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
Starts an async export operation, in the specified sheet. If such sheet does not exist, it gets created.
public void RunExportAsync(string fileName, ISpreadExportRenderer exportRenderer, string sheetName)
The file name where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
sheetNamestringName of the sheet.
Starts an export operation that runs in a background thread.
public void RunExportAsync(string fileName, ISpreadExportRenderer exportRenderer)
The file name where data will be exported.
exportRendererISpreadExportRendererInstance of ISpreadExportRenderer class.
When the value is numeric and the current culture uses a comma decimal separator, replaces commas in the text with periods.
Creates the export-cell model for each worksheet position, raises CellFormatting, and writes the rows.
protected virtual void WriteCells()
Events
Occurs when an async export operation is completed.
public event AsyncCompletedEventHandler AsyncExportCompleted
Occurs when the progress of an async export operation changes.
public event ProgressChangedEventHandler AsyncExportProgressChanged
Occurs for every cell that is being exported.
public event PivotGridSpreadExportCellFormattingEventHandler CellFormatting
Occurs when the export process completes.
public event EventHandler ExportCompleted