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

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:

C#
public class GridViewSpreadExport

Inheritance: objectGridViewSpreadExport

Constructors

Initializes a new instance of the GridViewSpreadExport class.

C#
public GridViewSpreadExport(RadGridView radGridView, SpreadExportFormat spreadExportFormat)
Parameters:radGridViewRadGridView

The grid to export.

spreadExportFormatSpreadExportFormat

The spread export format.

Initializes a new instance of the GridViewSpreadExport class.

C#
public GridViewSpreadExport(RadGridView radGridView)
Parameters:radGridViewRadGridView

The grid to export.

Properties

Gets or sets the child view export mode.

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

The child view export mode.

Gets or sets a value indicating whether to export hierarchy and group child rows grouped.

C#
public bool ExportChildRowsGrouped { 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 grouped columns.

C#
public bool ExportGroupedColumns { get; set; }

Gets or set if child rows should be exported.

C#
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.

C#
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.

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 a value indicating whether to freeze the header row in the exported file.

C#
public bool FreezeHeaderRow { get; set; }

Gets or sets a value indicating whether to freeze pinned columns.

C#
public bool FreezePinnedColumns { get; set; }

Gets or sets a value indicating whether to freeze pinned rows.

C#
public bool FreezePinnedRows { get; set; }

Gets or sets a value indicating how hidden columns are exported.

C#
public HiddenOption HiddenColumnOption { get; set; }
Property Value:

The hidden column option.

Gets or sets a value indicating how hidden rows are exported.

C#
public HiddenOption HiddenRowOption { get; set; }
Property Value:

The hidden row option.

Gets or sets a value indicating how the export behaves when paging is enabled.

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

The paging export option.

Gets or sets the RadGridView to export.

C#
public RadGridView RadGridViewToExport { get; set; }
Property Value:

The RadGridView to export.

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 how summary rows are exported.

C#
public SummariesOption SummariesExportOption { get; set; }
Property Value:

The summaries export option.

Methods

Adds a sparkline as a floating PNG image positioned over its worksheet cell.

C#
protected virtual void AddSparkImage(GridViewRowInfo gridViewRowInfo, GridViewSparklineColumn sparklineColumn, int rowIndex, int columnIndex, int skippedCells, Point imageOffset)
Parameters:gridViewRowInfoGridViewRowInfo

The row containing the sparkline data.

sparklineColumnGridViewSparklineColumn

The column that supplies the sparkline series settings.

rowIndexint

The target worksheet row index.

columnIndexint

The column position used to calculate the target worksheet column.

skippedCellsint

The number of omitted cells to account for in the worksheet column position.

imageOffsetPoint

The horizontal and vertical placement offset.

Cancels an asynchronous export operation.

C#
public void CancelExportAsync()

Creates an export traverser rooted at the grid's master view.

C#
protected virtual ExportGridTraverser CreateTraverser()
Returns:

ExportGridTraverser

A new traverser for the exported grid.

Removes the temporary sparkline element from the grid and disposes it and its series when attached.

C#
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.

C#
protected virtual Image GetSparkImage(GridViewRowInfo gridViewRowInfo, GridViewSparklineColumn sparklineColumn, int width, int height)
Parameters:gridViewRowInfoGridViewRowInfo

The row containing the sparkline values.

sparklineColumnGridViewSparklineColumn

The column whose series and indicator settings are applied.

widthint

The image width in pixels.

heightint

The image height in pixels.

Returns:

Image

The rendered image, or null when the row's cell value is not a double array.

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(CellFormattingEventArgs e)
Parameters:eCellFormattingEventArgs

The CellFormattingEventArgs instance containing the event data.

Raises the event.

C#
protected virtual void OnChildViewExporting(ChildViewExportingEventArgs e)
Parameters:eChildViewExportingEventArgs

The ChildViewExportingEventArgs 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.

exportRendererISpreadExportRenderersheetNamestring

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

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.

exportRendererISpreadExportRenderersheetNamestring

Name of the sheet.

Starts an export operation.

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

The file name where data will be exported.

exportRendererISpreadExportRenderer

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.

exportRendererISpreadExportRenderersheetNamestring

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.

exportRendererISpreadExportRenderersheetNamestring

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.

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 CellFormattingEventHandler CellFormatting

Occurs when a child view will be exported.

C#
public event ChildViewExportingEventHandler ChildViewExporting

Occurs when the export process completes.

C#
public event EventHandler ExportCompleted