How to get the Spellchecker to work in the sfDataGrid control?

I have tried to get the Spellchecker to work in a sfDataGrid but have not been able to. I want to be able to underline or some other way highlight misspelled words within a cell  from a sfDataGrid using the SpellChecker capability. 

3 Replies 1 reply marked as answer

SS Susmitha Sundar Syncfusion Team June 7, 2020 04:24 AM UTC

Hi George, 
 
Thank you for using Syncfusion controls. 
 
Your requirement “SpellCheck for GridCell” can be achieved by custom column. We have created the new GridSpellCheckColumn and SpellCheckCellRenderer for checking the GridCell text.  
 
this.sfDataGrid1.CellRenderers.Add("SpellCheck", new SpellCheckCellRenderer(this.sfDataGrid1)); 
 
public class SpellCheckCellRenderer : GridTextBoxCellRenderer 
{ 
    //Using SpellChecker tool. 
    private SpellCheckerAdv spellchecker; 
    public SpellCheckCellRenderer(SfDataGrid sfdataGrid) 
    { 
        spellchecker = new SpellCheckerAdv(); 
 
    } 
 
    protected override void OnRender(Graphics paint, Rectangle cellRect, string cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex) 
    { 
        string check = this.spellchecker.SpellCheck(cellValue.ToString()); 
        //Checking whether the result has suggestions. 
        if (check != "") 
        { 
            style.Font.Underline = true; 
 
        } 
        base.OnRender(paint, cellRect, cellValue, style, column, rowColumnIndex); 
    } 
 
    
} 
public class GridSpellCheckColumn : GridTextColumn 
{ 
    public GridSpellCheckColumn() 
    { 
        SetCellType("SpellCheck"); 
    } 
} 
 
 
 
 
 
Please check the sample and let us know if you need further assistance on this. 
 
Regards, 
Susmitha S 


Marked as answer

GB George Busby June 7, 2020 06:56 PM UTC

This highlighted all of the text if any of the words are miss-spelled. Is it possible to only highlight the miss-spelled words ( just like this editor does when I type in a message i.e mispled )?  Also, if there is a misspelled word can the Spellchecker give suggestions for the correct spelling ( again just like the editor for this message does when you right click over a red underlined word)? 
Note: my code is in VB if possible can you send examples in VB?  If not, I can convert to VB.

Example of showing suggested corrections for a misspelled word:



SS Susmitha Sundar Syncfusion Team June 8, 2020 03:33 PM UTC

Hi George , 
 
Sorry for the inconvenience caused.   
 
By default, SfDataGrid does not provide support to spellchecker. So we have prepared workaround for this. We can’t achieve your request behaviour  “provide the suggestion of misspelled words” by workaround. 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Susmitha S  


Loader.
Up arrow icon