We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to export a selected range of WinForms GridControl to Excel?

Platform: WinForms |
Control: GridControl
Tags: exporting

Excel export

You can export selected range of cells to excel by using ExportRange method. In this example, the selected range is passed as the parameter to the ExportRange method.


private void button1_Click(object sender, System.EventArgs e)
     Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();
     SaveFileDialog saveFileDialog = new SaveFileDialog();
     saveFileDialog.Filter = "Files(*.xls)|*.xls";
     saveFileDialog.DefaultExt = ".xls";
     GridRangeInfoList list = this.gridControl1.Model.SelectedRanges;
     if (saveFileDialog.ShowDialog() == DialogResult.OK)
        foreach (GridRangeInfo range in list)
          gecc.ExportRange(range, this.gridControl1.Model, saveFileDialog.FileName,
        if (MessageBox.Show("Do you wish to open the xls file now?", "Export to Excel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
           Process proc = new Process();
           proc.StartInfo.FileName = saveFileDialog.FileName;



Private Sub button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
  Dim gecc As New Syncfusion.GridExcelConverter.GridExcelConverterControl()
  Dim saveFileDialog As New SaveFileDialog()
  saveFileDialog.Filter = "Files(*.xls)|*.xls"
  saveFileDialog.DefaultExt = ".xls"
  Dim list As GridRangeInfoList = Me.gridControl1.Model.SelectedRanges
  If saveFileDialog.ShowDialog() = DialogResult.OK Then
  For Each range As GridRangeInfo In list
    gecc.ExportRange(range, Me.gridControl1.Model, saveFileDialog.FileName, Syncfusion.GridExcelConverter.ConverterOptions.RowHeaders)
  Next range
  If MessageBox.Show("Do you wish to open the xls file now?", "Export to Excel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
     Dim proc As New Process()
     proc.StartInfo.FileName = saveFileDialog.FileName
  End If
  End If
End Sub

Show the Export to excel option in grid

Grid data moves to the excel sheet


C#: ExportingSelectedCells-C#.

VB: ExportingSelectedCells-VB.

Reference link: https://help.syncfusion.com/windowsforms/grid-control/exporting#excel-export

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile