Category / Section
How to export the Tooltip values to excel from GridControl ?
1 min read
Tooltip of the grid cells can be exported to excel with the help of QueryImportExportCellInfo event. In the given sample, all the excel cells are exported with the corresponding tooltip values of the grid cells. The same can be customized as per the requirement.
C#:
private void button2_Click(object sender, EventArgs e) { Syncfusion.GridExcelConverter.GridExcelConverterControl gecc = new Syncfusion.GridExcelConverter.GridExcelConverterControl(); gecc.QueryImportExportCellInfo += new GridImportExportCellInfoEventHandler(gecc_QueryImportExportCellInfo); //converting the grid to excel gecc.GridToExcel(this.gridControl1.Model, saveFileDialog.FileName); } private void gecc_QueryImportExportCellInfo(object sender, GridImportExportCellInfoEventArgs e) { IRange range = e.ExcelCell; //grid tooltip value has been assigned to excel cell value. range.Value = e.GridCell.CellTipText.ToString(); e.Handled = true; }
VB:
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Dim gecc As New Syncfusion.GridExcelConverter.GridExcelConverterControl() AddHandler gecc.QueryImportExportCellInfo, AddressOf gecc_QueryImportExportCellInfo 'converting the grid to excel gecc.GridToExcel(Me.gridControl1.Model, saveFileDialog.FileName) End Sub Private Sub gecc_QueryImportExportCellInfo(ByVal sender As Object, ByVal e As GridImportExportCellInfoEventArgs) Dim range As IRange = e.ExcelCell 'grid tooltip value has been assigned to excel cell value. range.Value = e.GridCell.CellTipText.ToString() e.Handled = True End Sub
Sample
C#: Export ToolTip
VB: Export ToolTip