New to Telerik UI for WinFormsStart a free 30-day trial

RadSpreadStreamProcessing Export

Updated on Sep 24, 2025

The GridViewSpreadStreamExport uses the RadSpreadStreamProcessing library which allows you to create big documents (without loading the entire document in the memory) and export them to the most common formats.

Figure 1: Exporting RadGridView.

WinForms RadGridView SpreadStreamProcessing Export

The spread export functionality is located in the TelerikExport.dll assembly. You need to include the following namespace in order to access the types contained in TelerikExport:

  • Telerik.WinControls.Export

Since this functionality is using the RadSpreadStreamProcessing library you need to reference the following assembly as well:

  • Telerik.Documents.SpreadsheetStreaming

The TelerikExport.dll must be the same version as the rest of the Assemblies. <Progress installation folder>\Bin folder holds the assemblies targetting .NET 2.0, while the ones in <Progress installation folder>\Bin40 are for .NET 4.0.

Exporting

To use the spread export functionality create an instance of the GridViewSpreadStreamExport object. Pass as a parameter the RadGridView instance to export. Afterward, the RunExport method will trigger the export process. The latter method accepts as a parameter the filename of the file to be exported and a SpreadStreamExportRenderer instance.

Exporting the grid.

C#
GridViewSpreadStreamExport spreadStreamExport = new GridViewSpreadStreamExport(this.radGridView1);
spreadStreamExport.ExportVisualSettings = true;
spreadStreamExport.RunExport(@"D:\StreamExport.xlsx", new SpreadStreamExportRenderer());

Properties

PropertyDescription
ExportHierarchySet it to true if you want to export the child templates/rows.
ExportVisualSettingsGets or sets a value indicating whether the visual settings should be exported.
SheetNameGets or sets the name of the sheet.
SheetMaxRowsGets or sets the maximum number of rows per sheet.
SummariesExportOptionGets or sets a value indicating how summary rows are exported.
HiddenColumnOptionGets or sets a value indicating how hidden columns are exported.
HiddenRowOptionGets or sets a value indicating how hidden rows are exported.
PagingExportOptionGets or sets a value indicating how the export behaves when paging is enabled.
ChildViewExportModeDefines which child view of a hierarchy row to be exported. Available modes are: - ExportFirstView: The exporter exports the first view. - ExportCurrentlyActiveView: The exporter exports the view that is actived in the grid. - SelectViewToExport: In this mode the ChildViewExporing event is fired. The event allows to choose the view to export in row by row basis. - ExportAllViews: In this mode all child views are exported. Available in GridViewSpreadExport and GridViewPdfExport.
RadGridViewToExportGets or sets the RadGridView to export.
ExportFormatGets or sets the format of the exported file - XLSX or CSV.
ExportGroupedColumnsGets or sets a value indicating whether to export grouped columns.
FreezeHeaderRowGets or sets a value indicating whether to freeze the header row in the exported file.
FreezePinnedRowsGets or sets a value indicating whether to freeze pinned rows.
FreezePinnedColumnsGets or sets a value indicating whether to freeze pinned columns.
ExportChildRowsGroupedGets or sets a value indicating whether to export hierarchy and group child rows grouped.
ExportViewDefinitionGets or sets a value indicating whether to export view definition
FileExportModeThis property determines whether the data will be exported into an existing or a new file. Available options are: NewSheetInExistingFile(this option will create a new sheet in an already existing file) and CreateOrOverrideFile which creates new or overrides the existing file.

Each column in RadGridView has ExcelExportType property which can be used for explicitly setting the data type of the cells in the exported document. In order to change the format of the exported data, you can set the ExcelExportType property of the specific column to Custom and specify the ExcelExportFormatString property with the desired format. Examples of such formats are available here: https://support.office.com/en-us/article/Format-a-date-the-way-you-want-8e10019e-d5d8-47a1-ba95-db95123d273e?ui=en-US&rs=en-US&ad=US

Events

CellFormatting

This event occurs for every cell that is being exported. It can be used for styling the cells or applying a custom format to the cells values.

Using the CellFormatting event

C#
private void SpreadStreamExport_CellFormatting(object sender, SpreadStreamCellFormattingEventArgs e)
{
    e.CellStyleInfo.BackColor = Color.Green;
    e.CellStyleInfo.ForeColor = Color.Red;
    e.CellStyleInfo.BottomBorder = new SpreadBorder(SpreadBorderStyle.Double, SpreadThemableColor.FromRgb(100, 100, 100));
    e.CellStyleInfo.TopBorder = Color.Black;
}

RowCreated

Occurs when a new row is created in current worksheet. This is suitable place to set any row properties (like height) and/or add indent cells.

Using RowCreated to set the rows height.

C#
private void SpreadStreamExport_RowCreated(object sender, SpreadStreamRowEventArgs e)
{
    if (e.GridRowInfoType == typeof(GridViewTableHeaderRowInfo))
    {
        var row = e.Row as Telerik.Documents.SpreadsheetStreaming.IRowExporter;
        row.SetHeightInPixels(50);
    }
}

RowExporting

Occurs before every spread row is exported. This is suitable place to add any additional cells at the end of the row.

C#
private void SpreadStreamExport_RowExporting(object sender, SpreadStreamRowEventArgs e)
{
    if (e.GridRowIndex % 2 == 0)
    {
        var row = e.Row as IRowExporter;
        using (ICellExporter cell = row.CreateCellExporter())
        {
            SpreadCellFormat format = new SpreadCellFormat()
            {
                Fill = SpreadPatternFill.CreateSolidFill(new SpreadColor(100, 100, 100))
            };
            cell.SetValue("---");
            format.HorizontalAlignment = SpreadHorizontalAlignment.Center;
            format.VerticalAlignment = SpreadVerticalAlignment.Center;
            format.LeftBorder = new SpreadBorder(SpreadBorderStyle.Double, SpreadThemableColor.FromRgb(100, 100, 100));
            format.RightBorder = new SpreadBorder(SpreadBorderStyle.Double, SpreadThemableColor.FromRgb(100, 100, 100));
            cell.SetFormat(format);
        }
    }
}

ExportCompleted

Occurs when the export process completes. This event is suitable for notifying the user that the exported operation is now completed.

ChildViewExporting

Occurs when a child view will be exported. This event is suitable for checking whether a child view will be exported or not.

Asynchronous Export

This feature can be utilized by calling the RunExportAsync method on the GridViewSpreadStreamExport object. In addition there are two events that fire when this export method is used:

  • AsyncExportCompleted: Fires when the export operation is completed.
  • AsyncExportProgressChanged: Fires repeatedly and passes the current export progress.

When you are exporting with visual settings the UI would be friezed for some time. This is necessary because the exporter need to retrieve all grid styles and this operation is executed on the UI thread.

Figure 2: The asynchronous export.

WinForms RadGridView Asynchronous Export

Exporting asynchronously and reporting the progress.

C#
private void RadButton1_Click(object sender, EventArgs e)
{
    GridViewSpreadStreamExport spreadStreamExport = new GridViewSpreadStreamExport(this.radGridView1);
    spreadStreamExport.AsyncExportProgressChanged += SpreadStreamExport_AsyncExportProgressChanged;
    spreadStreamExport.AsyncExportCompleted += SpreadStreamExport_AsyncExportCompleted;
    spreadStreamExport.RunExportAsync(@"D:\StreamExport.xlsx", new SpreadStreamExportRenderer());
}
private void SpreadStreamExport_AsyncExportCompleted(object sender, AsyncCompletedEventArgs e)
{
    RadMessageBox.Show("Export Completed");
}
private void SpreadStreamExport_AsyncExportProgressChanged(object sender, ProgressChangedEventArgs e)
{
    radProgressBar1.Value1 = e.ProgressPercentage;
}

See Also