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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Exxort multiple grids to one excel file

Thread ID:

Created:

Updated:

Platform:

Replies:

44533 May 25,2006 04:16 PM UTC Apr 25,2008 03:09 PM UTC WinForms 5
loading
Tags: GridControl
ralph_lachance
Asked On May 25, 2006 04:16 PM UTC

Hi gang, Is it possible to somehow combine the results of several grids into a single file for Excel. I''d be happy with either having the result appear in excel as one grid per worksheet, or just having the multiple grids stack up vertically on one worksheet.

Administrator [Syncfusion]
Replied On May 26, 2006 03:47 AM UTC

Hi Ralph, Yes it is possible to export multiple grids to a single XLS file as worksheets. Below is a code snippet. using Syncfusion.XlsIO; using Syncfusion.GridExcelConverter; private void button2_Click(object sender, System.EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "Files(*.XLS)|*.XLS"; saveFileDialog.AddExtension = true; saveFileDialog.DefaultExt = ".XLS"; if(saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.CheckPathExists) { GridExcelConverterControl gec = new GridExcelConverterControl(); IWorkbook workBook = ExcelUtils.CreateWorkbook(new string[] {"Sheet1","Sheet2"}); gec.GridToExcel(this.gridControl1.Model, workBook.Worksheets[0]); gec.GridToExcel(this.gridControl2.Model, workBook.Worksheets[1]); workBook.SaveAs(saveFileDialog.FileName); workBook.Close(); ExcelUtils.ThrowNotSavedOnDestroy = false; } } } Regards, Calvin.

Administrator [Syncfusion]
Replied On May 31, 2006 09:11 AM UTC

Calvin, Thanks for the (great) reply. I had not inferred the poss. from the api docs, so I''m grateful for your tip.

Harish
Replied On April 10, 2008 02:11 PM UTC

Thanks for the sample code. I have another question related to this. Is there a way to name the worksheets that are created?


Harish
Replied On April 10, 2008 03:32 PM UTC

Also I observed that every percentage column shows incorrect data. For ex 60% is shown as 0.6 in the excel. Any means to avoid this and show the actual value?


Sri Rajan [Syncfusion]
Replied On April 25, 2008 03:09 PM UTC

HiRalph,

Thank you for your patience.

Issue 1:Is there a way to name the worksheets that are created?
>>>>>
Please refer the below code snippet to name a worksheet after it was created.
workBook.Worksheets[0].Name = "S1";

Issue 2: Problem in Percentage Column value.
>>>>
Percentage cell value is perfectly converted and displayed as correct value in excel(60% in grid is displayed as 60% in excel).Here is the minimal sample which shows this issue.
http://websamples.syncfusion.com/samples/Grid.Windows/F44533/main.htm

Please let me know if this helps.

Best Regards,
Srirajan



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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

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

;