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

comments and header name

Hi,

I'm using GroupingGridExcelConverterControl.GroupingGridToExcel to convert a GGC into an excel file.

-I was wondering if there was a way to easily add comment in specific cells.
-It seems like the grid is showing the mapping name for the column header instead of the column name.



7 Replies

GM Geetha M Syncfusion Team April 27, 2009 07:49 AM UTC

Hi Stephane,

Thank you for your interest in Syncfusion products.

You can add comment to specific cell as shown in the sample located below:
My Documents\Syncfusion\EssentialStudio\7.1.0.30\Windows\XlsIO.Windows\Samples\2.0\Data Management\Interactive Features\

Please try this and let me know if you have any questions.

Regards,
Geetha



RC Rajadurai C Syncfusion Team April 27, 2009 11:32 AM UTC

Hi Stephane,

Thanks for your interest in Syncfusion products.

2) By default, the text set in the Name property of columndescriptor get exported to excel sheet. The text set to HeaderText property, which even display in grid cannot get exported to excel sheet. There is no direct way for exporting HeaderText set to the column with the available GroupingGridExcelConverterControl. However you can workaround this issue by setting HeaderText to the range.Text property.

Please refer to the following sample in which i used a GroupingGridExcelConverterControlExt class derived from GridExcelConverterBase class for excel export. In this class, some code in ExportColumnHeader(..) has been modified inorder to export the header text set to the column.
http://files.syncfusion.com/support/samples/Grid.Windows/7.1.0.30/F80741.zip

Regards,
Rajadurai



S_ Stephane _ April 27, 2009 07:40 PM UTC

Rajadurai, if I understand correctly. In your sample you are creating your own GroupingGridExcelConverterControl?

If this is the case, I might be able to add Geetha solution into your sample.




RC Rajadurai C Syncfusion Team April 28, 2009 01:23 PM UTC

Hi Stephane,

Thanks for your update.

Yes. It is possible to apply comments to the excel sheet cell with the provided sample. Please try the following code instead of the one handled in button1_Click event.

ExcelEngine engine = new ExcelEngine();
IApplication app = engine.Excel.Application;
IWorkbook book = app.Workbooks.Create();
book.Worksheets [0].Range["B15"].AddComment().Text = "Grid in ExcelSheet!";
GroupingGridExcelConverterControlExt gecc = new GroupingGridExcelConverterControlExt();
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Files(*.xls)|*.xls";
saveFileDialog.DefaultExt = ".xls";
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
gecc.GroupingGridToExcel(this.gridGroupingControl1, book.Worksheets[0], ConverterOptions.Default);
book.SaveAs(saveFileDialog.FileName);
if (MessageBox.Show("Do you wish to open the xls file now?", "Export to Excel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
Process proc = new Process();
proc.StartInfo.FileName = saveFileDialog.FileName;
proc.Start();
}
}


Regards,
Rajadurai



S_ Stephane _ April 30, 2009 03:31 PM UTC

The F80741 sample does not show the information in the SummaryRow.

Example, if I add this in the Load. I can see the beige row but its empty (in the excel file).


GridSummaryColumnDescriptor gscdHour = default(GridSummaryColumnDescriptor);
GridSummaryRowDescriptor gsrdTotal;

gsrdTotal = new GridSummaryRowDescriptor("TotalRow");
gsrdTotal.Appearance.AnyCell.BackColor = Color.Beige;
gsrdTotal.Appearance.AnyCell.HorizontalAlignment = Syncfusion.Windows.Forms.Grid.GridHorizontalAlignment.Right;
gsrdTotal.Title = "";

gscdHour = new GridSummaryColumnDescriptor("SNo", Syncfusion.Grouping.SummaryType.DoubleAggregate, "SNo", "{Sum}");
gsrdTotal.SummaryColumns.Add(gscdHour);

gridGroupingControl1.TableDescriptor.SummaryRows.Add(gsrdTotal);



RC Rajadurai C Syncfusion Team May 1, 2009 11:38 AM UTC

Hi Stephane,

In the custom class(GroupingGridExcelConverterControlExt), replace the following code in ExportSummaryRow() method

range.Text = style.FormattedText;

with

range.Text = column.GetDisplayText(summary.ParentGroup);

This exports the summary value in summary row to excel sheet.

Regards,
Rajadurai



S_ Stephane _ May 1, 2009 06:09 PM UTC

Thanks! It's working.

I see it was just commented off.


Loader.
Live Chat Icon For mobile
Up arrow icon