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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridToExcel

Thread ID:

Created:

Updated:

Platform:

Replies:

103922 Jun 8,2012 06:44 AM UTC Jun 26,2012 10:36 AM UTC Windows Forms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 8, 2012 06:44 AM UTC

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");


Ragamathulla B [Syncfusion]
Replied On 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.


Administrator [Syncfusion]
Replied On 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;

Ragamathulla B [Syncfusion]
Replied On June 26, 2012 10:36 AM UTC

Hi Silvio,

Please let me know if you have any further concerns.

Regards,

Ragamathullah B.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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

;