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

How to Export GridGroupingControl To Excel

Thread ID:

Created:

Updated:

Platform:

Replies:

94960 Jun 15,2010 05:39 AM UTC Jul 18,2016 09:41 AM UTC WinForms 5
loading
Tags: GridControl
Genu Smith
Asked On June 15, 2010 05:39 AM UTC

Hi
I want to know how it is possible to export GridGroupingControl to Excel?

Regards

Jisha Joy [Syncfusion]
Replied On June 15, 2010 08:52 AM UTC


Hi,

You could use GroupingGridExcelConverterControl class to export GridGroupingControl to excel. See the code:

Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl();

converter.GroupingGridToExcel(this.gridGroupingControl1,saveFileDialog.FileName,Syncfusion.GridExcelConverter.ConverterOptions.Default);

See the following browser sample for more details.

..\Windows\Grid.Grouping.Windows\Samples\2.0\Export\MS Excel Export Demo

Please let me know if this helps.

regards,
Jisha

Genu Smith
Replied On June 15, 2010 09:13 AM UTC

Hi
Thanks for your reply.But for the following code:

Dim theGridExcelConverter As New GroupingGridExcelConverterControl()
theGridExcelConverter.GroupingGridToExcel(Me.theMainGridControl, "C:\test.xls", Syncfusion.GridExcelConverter.ConverterOptions.Default)


I had this exception:


at Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.ExportColumnHeader(GridColumnHeaderRow headerRow, IWorksheet sheet, Element element, Int32 index, ConverterOptions options, Int32 iGroupLevel, Int32& iSkipCount)
at Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.ExportElements(IList arrElements, IWorksheet sheet, Int32 index, ConverterOptions options, Int32 iGroupLevel)
at Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.GroupingGridToExcel(GridGroupingControl grouping, IWorksheet sheet, ConverterOptions options)
at Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.GroupingGridToExcel(GridGroupingControl grouping, String strFileName, ConverterOptions options)
at Eadepardazan.BusinessPrototype.WinApp.PersonGridViewSmartPartControl.cmdExportGridDataToExcel(String strFilePath) in


Regards

Jisha Joy [Syncfusion]
Replied On June 16, 2010 08:37 AM UTC

Hi Genu,

Thank you for your update. Could you please provide the sample showing the issue or reproduce the issue in the browser sample provided?. So that we could sort out the cause of the issue and provide you a solution based on it.

Thanks,
Jisha

Joakim
Replied On July 14, 2016 01:13 PM UTC

I get this exception when I try to export to excel:

Method not found: 'Void Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl.GroupingGridToExcel(Syncfusion.Windows.Forms.Grid.Grouping.GridGroupingControl, Syncfusion.XlsIO.IWorksheet, Syncfusion.GridExcelConverter.ConverterOptions)'.

Here is my code:

private void toolStripButtonExcelExport_Click(object sender, EventArgs e)
        {
            GroupingGridExcelConverterControl gec = new GroupingGridExcelConverterControl();
            SaveFileDialog saveFileDialog = new SaveFileDialog();
            saveFileDialog.Filter = "Files(*.XLS)|*.XLS";
            saveFileDialog.AddExtension = true;
            saveFileDialog.DefaultExt = ".XLS";

            if (saveFileDialog.ShowDialog() == DialogResult.OK && saveFileDialog.CheckPathExists)
            {
                ExcelEngine Engine = new ExcelEngine();
                IWorkbook workbook = Engine.Excel.Workbooks.Create(1);
                IWorksheet sheet = workbook.Worksheets[0];

                gec.GroupingGridToExcel(gridGroupingControl_Employee, sheet, ConverterOptions.Visible);
                IRange usedRange = sheet.UsedRange;
                int Space = 5;
                int row = usedRange.Row + Space;
                int column = usedRange.Column;
                int lastRow = usedRange.LastRow + Space;
                int lastCol = usedRange.LastColumn;
                sheet.UsedRange.MoveTo(sheet[row, column, lastRow, lastCol]);
                sheet.UsedRange["A3:D3"].Merge(true);
                sheet.UsedRange["A3:D3"].Text = "This is Description";

                workbook.SaveAs(saveFileDialog.FileName);
                workbook.Close();
                Engine.Dispose();
            }
            gec.Dispose();
        }


As soon as the button i spressed, the exception is thrown. I put a breakpoint at the very top if this codeblock and it was never reached.

Piruthiviraj Malaimelraj [Syncfusion]
Replied On July 18, 2016 09:41 AM UTC

Hi Joakim, 

Thank you for using Syncfusion products. 

We had analyzed your query and created the simple sample as per your requirement. Unfortunately we could not able to reproduce the issue at our side. Can you please ensure the reported issue is reproduced in the attached sample or please let us know if we missed anything in your customization. This would be more helpful for us to provide the exact solution at the earliest. 

Sample link 

Regards, 
Piruthiviraj 


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

;