Articles in this section

How to export the grid to particular worksheet of existing workbook in WinForms GridControl?

Excel Export


The WinForms GridControl provides support to export the grid to a specified worksheet in an existing workbook by passing that worksheet as a parameter in the GridToExcel method, like below.

ExcelEngine engine = new ExcelEngine();
IApplication app = engine.Excel.Application;
app.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workBook = app.Workbooks.Create();
workBook = engine.Excel.Workbooks.Open("..\\..\\Sample.xlsx");
workBook.Version = ExcelVersion.Excel2013;
IWorksheet sheet = workBook.Worksheets["B"];
converter.GridToExcel(this.gridControl1, sheet, ConverterOptions.Visible);
workBook.Save();
Process.Start("..\\..\\Sample.Xlsx");
Dim engine As New ExcelEngine()
Dim app As IApplication = engine.Excel.Application
app.DefaultVersion = ExcelVersion.Excel2013
Dim workBook As IWorkbook = app.Workbooks.Create()
workBook = engine.Excel.Workbooks.Open("..\..\Sample.xlsx")
workBook.Version = ExcelVersion.Excel2013
Dim sheet As IWorksheet = workBook.Worksheets("B")
converter.GridToExcel(Me.gridControl1, sheet, ConverterOptions.Visible)
workBook.Save()
Process.Start("..\..\Sample.Xlsx")

Samples:

C#: Export_to_WorkSheet_CS

VB: Export_to_WorkSheet_VB

 

Reference Link: Exporting

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied