Category / Section
How to export CellCommentTips to Excel by using GridExcelConverterControl?
1 min read
You can export the CellCommentTips of GridControl to excel by handling the QueryImportExportCellInfo event handler. In this event, the GridExcelTipStyleProperties is checked for ExcelTip properties and accordingly the comment is added to the IRange.
C#
//Create grid excel converter object Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl(); //Hook the QueryImportExportCellInfo event to Export the comments. gecc.QueryImportExportCellInfo += new Syncfusion.GridExcelConverter.GridImportExportCellInfoEventHandler(gecc_QueryImportExportCellInfo); //Export the Comments to the Excel void gecc_QueryImportExportCellInfo(object sender, Syncfusion.GridExcelConverter.GridImportExportCellInfoEventArgs e) { ExcelCommentTip.GridExcelTipStyleProperties style = new ExcelCommentTip.GridExcelTipStyleProperties(e.GridCell); if (style.HasExcelTipText) e.ExcelCell.AddComment().Text = style.ExcelTipText; }
VB
'Create grid excel converter object Private gecc As New Syncfusion.GridExcelConverter.GridExcelConverterControl() 'Hook the QueryImportExportCellInfo event to Export the comments. Private gecc.QueryImportExportCellInfo += New Syncfusion.GridExcelConverter.GridImportExportCellInfoEventHandler(AddressOf gecc_QueryImportExportCellInfo) 'Export the Comments to the Excel Private Sub gecc_QueryImportExportCellInfo(ByVal sender As Object, ByVal e As Syncfusion.GridExcelConverter.GridImportExportCellInfoEventArgs) Dim style As New ExcelCommentTip.GridExcelTipStyleProperties(e.GridCell) If style.HasExcelTipText Then e.ExcelCell.AddComment().Text = style.ExcelTipText End If End Sub
Figure 1: Comment Tips In GGC
Figure 2: Exported Comment Tips in Excel
Sample Link:
ExportingCellTipCommetns-C#-1609704047.zip
ExportingCellTipComments-VB-868077761.zip