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. Image for the cookie policy date

How to implement spellcheck with SfDocumentEditorContainer on Blazor Server

Hi

How do I enable spell checking on the Document Editor in Blazor Server? It seems like a very basic requirement but I can't see anything in the documentation about this?

I've set EnableSpellCheck to "true" but nothing happened.

What are the exact steps to get spell checking working? Assume I'm an idiot, please.

<SfDocumentEditorContainer @ref="docEditor" EnableSpellCheck="true" Height="85vh" EnableToolbar=true>
       <DocumentEditorContainerEvents Created="OnWordEditorCreated"></DocumentEditorContainerEvents>
</SfDocumentEditorContainer>

3 Replies

SK Selvaprakash Karuppusamy Syncfusion Team May 8, 2023 03:48 PM UTC

Hi Aaron,

           To enable spellcheck, you need to add a dictionary on the server side and set the language ID on the server side as well. We have prepared a sample to meet your requirements, so please refer to the attached sample for your reference. 

Regards,

Selvaprakash K


Attachment: blazor_e6530af2.zip


AS Aaron Smith May 9, 2023 11:51 AM UTC

Hi

Thanks for the sample. The example is in Blazor Web Assembly. Will this work with Blazor Server? 

If I set the ServiceUrl do I need to implement the Import routine and other functions from that service? Is there no way to do this in a normal Blazor Server context?


Thanks.




SK Selvaprakash Karuppusamy Syncfusion Team May 10, 2023 10:46 AM UTC

Hi Aaron, 

Thanks for the sample. The example is in Blazor Web Assembly. Will this work with Blazor Server? 

Yes, it works for the Blazor server as well, and additionally added the code for your reference.

<SfDocumentEditorContainer @ref="container" EnableToolbar=true Height="590px" EnableSpellCheck="true"ServiceUrl="http://localhost:62870/api/documenteditor/">

   <DocumentEditorContainerEvents Created="OnLoad"></DocumentEditorContainerEvents> 

</SfDocumentEditorContainer>

 

@code {

    

    SfDocumentEditorContainer container;

    public void OnLoad(object args)

    {

        var spellcheck = container.DocumentEditor.SpellChecker; 

        // Document Editor provides multi-language spell check support. You can add as many languages (dictionaries) in the server-side and to use that language for spell checking in Document Editor, it must be matched with languageID you pass in the Document Editor.  

        spellcheck.SetLanguageIDAsync(1033); 

        spellcheck.SetRemoveUnderlineAsync(false); 

        spellcheck.SetAllowSpellCheckAndSuggestionAsync(true);

    }

 

}

If I set the ServiceUrl do I need to implement the Import routine and other functions from that service?

No, the mentioned serviceUrl is used for spellcheck interaction only.

 

 Is there no way to do this in a normal Blazor Server context?

Yes, need a separate project (attached in the previous update) if you want to use spellchecker in blazor.

 



Regards,

Selvaprakash K



Loader.
Up arrow icon