Articles in this section
Category / Section

How to export the Tooltip values to excel from GridControl?

Tooltip of the grid cells can be exported to Excel with the help of the 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.

 

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

The screenshots below illustrate the exporting of tooltip values to Excel.



Sample

C#: Export ToolTip

VB: Export ToolTip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied