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. Image for the cookie policy date
close icon

Unable to Export Formats in GridGroupingControl

Hi,
I am using a GridGroupingControl. I have used the TableControlPrepareViewStyleInfo event to dynamically highlight values in a few columns.

I now want to export this formatting to Excel.
I am trying to use the QueryExportPreviewRowInfo event, which is a converter event.
But the problem is that this event never gets hit even after attaching the delegate.
Please help to solve this problem or suggest some new method to export dynamic formatting to excel.

Thanks.




ExportFormat_2687c400.rar

5 Replies

JJ Jisha Joy Syncfusion Team January 13, 2011 07:14 AM UTC

Hi Pawan,

You could achieve the desired behavior by handling the QueryImportExportCellInfo event of the GridExcelConverterControl. Please refer to the code:


void converter_QueryImportExportCellInfo(object sender, Syncfusion.GridExcelConverter.GridImportExportCellInfoEventArgs e)
{
if (e.Action == Syncfusion.GridExcelConverter.GridConverterAction.Export)
{

if (e.ColIndex == 2 && e.RowIndex == 2)
{
e.ExcelCell.RichText.Text = e.GridCell.Text;
IRichTextString rtf = e.ExcelCell.RichText;

//Formatting first 4 characters
IFont greenFont = myWorkBook.CreateFont();
greenFont.RGBColor = Color.Green;
rtf.SetFont(0, 3, greenFont);

//Formatting last 4 characters
IFont blueFont = myWorkBook.CreateFont();
blueFont.RGBColor = Color.Blue;
rtf.SetFont(4, 7, blueFont);

e.Handled = true;
}


}
}

Sample for your reference:

http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GCXcelExport2066192961.zip

Please let me know if this helps.

Regards,
Jisha




PR Pawan Ragde January 13, 2011 10:06 AM UTC

Hi Jisha,

Thanks for the quick reply.

Im using a Grid Grouping Control. I handled the event as you said but i am still facing the same problem, the QueryImportExportCellInfo event does not fire even after i have handled it. Are there some converter or groupinggrid settings that i have to change.

Your example works perfectly but when i integrate the same in my code the event never gets fired.

Tahnks.



FormatProblem_b324531e.rar


PR Pawan Ragde January 13, 2011 10:06 AM UTC

Hi Jisha,

Thanks for the quick reply.

Im using a Grid Grouping Control. I handled the event as you said but i am still facing the same problem, the QueryImportExportCellInfo event does not fire even after i have handled it. Are there some converter or groupinggrid settings that i have to change.

Your example works perfectly but when i integrate the same in my code the event never gets fired.

Thanks.



JJ Jisha Joy Syncfusion Team January 17, 2011 10:06 AM UTC

Hi Pawan,

Please let me know the Essential Studio version you are using.

Regards,
Jisha



PR Pawan Ragde November 7, 2011 03:26 PM UTC

Hi Jisha,

I had used the GridDataBoundGrid and this issue got resolved.

But now for a different grid i need to use the GridGroupingControl and facing the same problem as above.

Im using Essential Studio Version: 8.203.0.18

P.S: As of now im not using any grouping in the GridGrouping control.


Loader.
Live Chat Icon For mobile
Up arrow icon