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

GGC export to excel

Thread ID:

Created:

Updated:

Platform:

Replies:

55635 Feb 1,2007 09:41 PM UTC Feb 15,2007 03:04 PM UTC Windows Forms 7
loading
Tags: GridControl
Lan Mo
Asked On February 1, 2007 09:41 PM UTC

Hi,
I've just upgraded from v3.3.0.0 to v4.4.0.51 in
VS2003. I want to export Grouping Grid Control to excel. Do you have any build-in functions and samples?
Thanks,

Lan

Administrator [Syncfusion]
Replied On February 1, 2007 10:39 PM UTC

Hi Lan,

The Excel export browser sample demonstrates the conversion of contents in a GridGroupingControl to an xls file. The Exporting of a GridGroupingControl has two options: one converts the entire contents in the grid while the other converts only the visible contents in the grid.

XlsIO libraries are used to convert the grid contents to excel. The dlls that these depend on are Syncfusion.XlsIO.Base and Syncfusion.GridConverter.Windows.

Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new
Syncfusion.GroupingGridExcelConverter.GroupingGridExcelConverterControl();
converter.GroupingGridToExcel(this.gridGroupingControl1,
saveFileDialog.FileName,Syncfusion.GridExcelConverter.ConverterOptions.Default);

The above code converts the entire contents in the grid. The code to export the visible or expanded records or groups alone is given below.

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

Here is a path.
[instal drive]\Syncfusion\Essential Studio\4.4.0.49\Windows\Grid.Grouping.Windows\Samples\Serialization\Excel Export

Best Regards,
Haneef

Sample : Excel Export.zip

Administrator [Syncfusion]
Replied On February 2, 2007 04:37 PM UTC

Hi,
Thank you for help.

I have two problems with exported result.
1. I want to coloumn header text description instead of the colomn field name.

2. For the lookup combobox pickup cell, I want to the cell text(lookup description) to be exported instead the cell value (lookup code)

In general, I want to export like What you see in grid, what you get in excel.

Please see the attached files: ExportExcel1.jpg (Excel screen) and ExportExcel2.jpg(Grid screen)

How can I do that?

Thanks,

Lan


ExportExcel0.zip

Administrator [Syncfusion]
Replied On February 2, 2007 08:24 PM UTC

Hi Lan,

You would have to derive the GridExcelConverterBase class and export the elements using the ExportXXXX method. Please try the attached sample and let me know if you are looking something different.

sample : GGCExcelExportHeaderText.zip

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 5, 2007 02:56 PM UTC

Hi,
Thanks for help.

I've tried your sample. It works well except for the Aggregate rows'(SUM,MIN,MAX,AVG) title text and value format(the green arrow means need to convert text to number). Please see my attached screen shot and exported excel file.

Lan






ExportExcel1.zip

Administrator [Syncfusion]
Replied On February 5, 2007 03:15 PM UTC

Hi,
I forgot another issue in exported excel file.

The group title, such as 'Benefit Level: 2 - 1 Items', displays value '2'. It should display the description text 'BENEFIT LEVEL 2'.

Lan




Administrator [Syncfusion]
Replied On February 6, 2007 11:25 PM UTC

Hi Lan,

Please try the attached sample and let me know if you are trying something different.
GGC_SummaryRowExport.zip

Best regards,
Haneef

Administrator [Syncfusion]
Replied On February 15, 2007 03:04 PM UTC

Hi Haneef,
Thanks for help.

Your sample works well for me except one thing.

I want to the summary cell's formatting style is same as its column's formatting style. Now it is always formatted as 'text', which displays in excel2003 with a 'green triangle' at top-left corner of the cell.

I've modified ExportSummaryRow in class GroupingGridExcelConverterControlExt as below:

private int ExportSummaryRow( GridSummaryRow summary, IWorksheet sheet, int index,
ConverterOptions options , int iGroupLevel )
{
....

// lan: Skip for the Title cell:range = sheet.Range[ iRow, iGroupLevel ]
// because it has been setup in code before the loop
// if( iColumnIndex == -1 )
// {
// range = sheet.Range[ iRow, iGroupLevel ];
// }
// else
// {
// range = sheet.Range[ iRow, iGroupLevel + iColumnIndex ];
// style = table.Appearance.SummaryFieldCell;
// CopyStyle( style, range );
// }
// range.Text = column.GetDisplayText( summary.ParentGroup );
if( iColumnIndex >0 )
{

range = sheet.Range[ iRow, iGroupLevel + iColumnIndex ];
style = table.Appearance.SummaryFieldCell;
CopyStyle( style, range );
//range.Text = column.GetDisplayText( summary.ParentGroup );
range.Value=column.GetDisplayText( summary.ParentGroup );

}

....
}

It looks working well for me now, but I am not sure my modification is correct because I do not fully understand the whole idea behind the class GroupingGridExcelConverterControlExt.

and in the future, you may fix or add more code in this class, Is it necessary for me to get the updaged one? and how can I get the most updated one?

Thanks again.

Lan





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

;