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.

How to use GroupingGridExcelConverterControl to export data as .xlsx format?

Thread ID:

Created:

Updated:

Platform:

Replies:

117867 Dec 31,2014 04:05 AM Jan 1,2015 11:57 PM Windows Forms 1
loading
Tags: GridGroupingControl
Yujin Wu
Asked On December 31, 2014 04:05 AM

Hi Team,
 
Below code is ok for saving as .xls fileformat however it failed when I saved it as .xlsx. Could you give suggestions how to export data as .xlsx file format?
 
// my grid
private GridGroupingControl _gridGroupingControl1;
// save to .xls
using (GroupingGridExcelConverterControl converter = new GroupingGridExcelConverterControl()) 
      converter.GroupingGridToExcel(_gridGroupingControl1, @"D:\export.xls", ConverterOptions.Default);
 
Thanks,
Wuyj

Neelakandan Kannan [Syncfusion]
Replied On January 1, 2015 11:57 PM

Hi Wuyj,

Thank you for your interest in Syncfusion products.

If you want to save the GridGroupingControl exported excel file as .XLSX, you can specify the Worksheet version and excel engine version as 2013. Please make use of below code,

Code Snippet:

private void button1_Click(object sender, EventArgs e)

{

GroupingGridExcelConverterControl converter = new GroupingGridExcelConverterControl();

ExcelEngine excelEngine = new ExcelEngine();

IApplication application = excelEngine.Excel;

application.DefaultVersion = ExcelVersion.Excel2013;

IWorkbook chartBook = ExcelUtils.CreateWorkbook(1);

chartBook.Version = ExcelVersion.Excel2013;

IWorksheet sheet = chartBook.Worksheets[0];

converter.GroupingGridToExcel(this.gridGroupingControl1,sheet, ConverterOptions.Default);

chartBook.SaveAs("sample.xlsx");

Process.Start("sample.xlsx");

}

Sample:

http://www.syncfusion.com/downloads/support/directtrac/117867/Sample_Exporting95361951.zip

Please let me know if you have any concerns.

Regards,

Neelakandan



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.

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.

;