2X faster development
The ultimate WinForms UI toolkit to boost your development speed.
Save the gridIn order to save the grid control with changed values, we have to save the Workbook after exporting the grid to excel. IWorkBook.Save() method can be used to save the changed values in spread sheet. C# private void btnExport_Click(object sender, EventArgs e) { ExcelEngine engine = new ExcelEngine(); IApplication app = engine.Excel.Application; app.DefaultVersion = ExcelVersion.Excel2010; IWorkbook workBook = app.Workbooks.Create(); workBook = engine.Excel.Workbooks.Open(@"..\..\Book1.xlsx"); IWorksheet sheet = workBook.Worksheets[0]; control.GridToExcel(this.gridControl1, sheet, ConverterOptions.Default); //Save the workbook. workBook.Save(); Process.Start(@"..\..\Book1.xlsx"); }
VB Private Sub btnExport_Click(ByVal sender As Object, ByVal e As EventArgs) Dim engine As New ExcelEngine() Dim app As IApplication = engine.Excel.Application app.DefaultVersion = ExcelVersion.Excel2010 Dim workBook As IWorkbook = app.Workbooks.Create() workBook = engine.Excel.Workbooks.Open("..\..\Book1.xlsx") Dim sheet As IWorksheet = workBook.Worksheets(0) control.GridToExcel(Me.gridControl1, sheet, ConverterOptions.Default) 'Save the workbook. workBook.Save() Process.Start("..\..\Book1.xlsx") End Sub
Samples: 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.
This page will automatically be redirected to the sign-in page in 10 seconds.