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.

comments and header name

Thread ID:

Created:

Updated:

Platform:

Replies:

80741 Apr 24,2009 11:33 AM May 1,2009 02:09 PM Windows Forms 7
loading
Tags: XlsIO
Stephane _
Asked On April 24, 2009 11:33 AM

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.



Geetha M [Syncfusion]
Replied On April 27, 2009 03:49 AM

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


Rajadurai C [Syncfusion]
Replied On April 27, 2009 07:32 AM

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


Stephane _
Replied On April 27, 2009 03:40 PM

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.



Rajadurai C [Syncfusion]
Replied On April 28, 2009 09:23 AM

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


Stephane _
Replied On April 30, 2009 11:31 AM

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);


Rajadurai C [Syncfusion]
Replied On May 1, 2009 07:38 AM

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


Stephane _
Replied On May 1, 2009 02:09 PM

Thanks! It's working.

I see it was just commented off.


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.

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.

;