GridViewSpreadExport
GridViewSpreadExport is a powerful exporting API, allowing to export RadGridView to XLSX, PDF, CSV, and TXT format, utilizing the Document Processing Libraries.
Definition
Namespace:Telerik.WinControls.Export
Assembly:Telerik.WinControls.GridView.dll
Syntax:
public class GridViewSpreadExport
Inheritance: objectGridViewSpreadExport
Constructors
Initializes a new instance of the GridViewSpreadExport class.
public GridViewSpreadExport(RadGridView radGridView, SpreadExportFormat spreadExportFormat)
The grid to export.
spreadExportFormatSpreadExportFormatThe spread export format.
Initializes a new instance of the GridViewSpreadExport class.
public GridViewSpreadExport(RadGridView radGridView)
The grid to export.
Properties
Gets or sets the child view export mode.
public ChildViewExportMode ChildViewExportMode { get; set; }
The child view export mode.
Gets or sets a value indicating whether to export hierarchy and group child rows grouped.
public bool ExportChildRowsGrouped { 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 grouped columns.
public bool ExportGroupedColumns { get; set; }
Gets or set if child rows should be exported.
public bool ExportHierarchy { get; set; }
Gets or sets a value indicating whether to export view definition. Note that if using
RunExportAsync method to export, the view definition will not be exported.public bool ExportViewDefinition { get; set; }
Gets or sets a value indicating whether the visual settings should be exported. Note that if using
RunExportAsync method to export, the visual settings will not 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 a value indicating whether to freeze the header row in the exported file.
public bool FreezeHeaderRow { get; set; }
Gets or sets a value indicating whether to freeze pinned columns.
public bool FreezePinnedColumns { get; set; }
Gets or sets a value indicating whether to freeze pinned rows.
public bool FreezePinnedRows { get; set; }
Gets or sets a value indicating how hidden columns are exported.
public HiddenOption HiddenColumnOption { get; set; }
The hidden column option.
Gets or sets a value indicating how hidden rows are exported.
public HiddenOption HiddenRowOption { get; set; }
The hidden row option.
Gets or sets a value indicating how the export behaves when paging is enabled.
public PagingExportOption PagingExportOption { get; set; }
The paging export option.
Gets or sets the RadGridView to export.
public RadGridView RadGridViewToExport { get; set; }
The RadGridView to export.
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 how summary rows are exported.
public SummariesOption SummariesExportOption { get; set; }
The summaries export option.
Methods
Adds a sparkline as a floating PNG image positioned over its worksheet cell.
protected virtual void AddSparkImage(GridViewRowInfo gridViewRowInfo, GridViewSparklineColumn sparklineColumn, int rowIndex, int columnIndex, int skippedCells, Point imageOffset)
The row containing the sparkline data.
sparklineColumnGridViewSparklineColumnThe column that supplies the sparkline series settings.
rowIndexintThe target worksheet row index.
columnIndexintThe column position used to calculate the target worksheet column.
skippedCellsintThe number of omitted cells to account for in the worksheet column position.
imageOffsetPointThe horizontal and vertical placement offset.
Cancels an asynchronous export operation.
public void CancelExportAsync()
Creates an export traverser rooted at the grid's master view.
protected virtual ExportGridTraverser CreateTraverser()
A new traverser for the exported grid.
Removes the temporary sparkline element from the grid and disposes it and its series when attached.
protected virtual void DetachSparkElemnt()
Creates a rasterized sparkline image from a double-array cell value using the column's settings, raising its exporting event before rendering.
protected virtual Image GetSparkImage(GridViewRowInfo gridViewRowInfo, GridViewSparklineColumn sparklineColumn, int width, int height)
The row containing the sparkline values.
sparklineColumnGridViewSparklineColumnThe column whose series and indicator settings are applied.
widthintThe image width in pixels.
heightintThe image height in pixels.
Returns:The rendered image, or null when the row's cell value is not a double array.
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(CellFormattingEventArgs e)
The CellFormattingEventArgs instance containing the event data.
Raises the event.
protected virtual void OnChildViewExporting(ChildViewExportingEventArgs e)
The ChildViewExportingEventArgs 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.
exportRendererISpreadExportRenderersheetNamestringName of the sheet.
Starts an export operation.
public void RunExport(Stream exportStream, ISpreadExportRenderer exportRenderer)
The stream where data will be exported.
exportRendererISpreadExportRendererStarts 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.
exportRendererISpreadExportRenderersheetNamestringName of the sheet.
Starts an export operation.
[SecurityCritical]
public void RunExport(string fileName, ISpreadExportRenderer exportRenderer)
The file name where data will be exported.
exportRendererISpreadExportRendererStarts 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.
exportRendererISpreadExportRenderersheetNamestringName 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.
exportRendererISpreadExportRenderersheetNamestringName 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.
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 CellFormattingEventHandler CellFormatting
Occurs when a child view will be exported.
public event ChildViewExportingEventHandler ChildViewExporting
Occurs when the export process completes.
public event EventHandler ExportCompleted