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
close icon

GridToExcel

Hi, is there a way to specify the Excel version to use when exporting to grid using GridExcelConverter.GridExcelConverterControl.GridToExcel
just using output file name, WITHOUT passing through the workbook.SaveAs method ?


 

The GridExcelConverter class provides support for exporting data from a Grid control or Grid Data Bound Grid into an Excel spreadsheet for verification and/or computation. This control automatically copies the Grid's styles and formats to Excel. The GridExcelConverter control is derived from the GridExcelConverterBase. The XlsIO libraries support the conversion of Grid content to Excel.

 

To make use of the GridExcelConverter class, the following assemblies should be added along with the default assemblies present in the References folder of your application: Syncfusion.GridConverter.Base andSyncfusion.XlsIO.Base.

 

The GridToExcel method is used to export the grid to an Excel sheet. The following code example illustrates how to convert the Grid content to Excel.

 

[C#]

 

Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl();

gecc.GridToExcel(this.gridControl1.Model, @"C:\MyGC.xls");


3 Replies

RB Ragamathulla B Syncfusion Team June 15, 2012 09:51 AM UTC

Hi Silvio,

We deeply regret for the delay.

You can change the excel version when export to excel by manually. Please refer to the following code which explains the same.

GridExcelConverterControl gecc = new GridExcelConverterControl();
ExcelEngine engine = new ExcelEngine();
IApplication app = engine.Excel.Application;
app.DefaultVersion = ExcelVersion.Excel2007;
IWorkbook book = app.Workbooks.Create();
gecc.GridToExcel(MyGrid.Model, book.Worksheets[0], ConverterOptions.ColumnHeaders | ConverterOptions.RowHeaders);

Let me know if you have any further concerns.

Regards,

Ragamathullah B.



AD Administrator Syncfusion Team June 26, 2012 10:34 AM UTC

Thanks, I found another way to save with desired version

//Select the version to be saved
              workbook.Version = ExcelVersion.Excel2010;
 
              if (Path.GetExtension(ClaFileDialogHelper.FileName) == excel2003Ext)
                workbook.Version = ExcelVersion.Excel97to2003;


RB Ragamathulla B Syncfusion Team June 26, 2012 10:36 AM UTC

Hi Silvio,

Please let me know if you have any further concerns.

Regards,

Ragamathullah B.


Loader.
Live Chat Icon For mobile
Up arrow icon