SpellCheck in Document Editor not working

Dear Sir,

I added the enableSpellCheck=true in the documenteditor but it is not working.

Can you help me to see what is the issue?


 <ejs-documenteditorcontainer id="container" height="80%" enableSpellCheck=true></ejs-documenteditorcontainer>


 function LoadWord() {

        var documenteditor;

        var documenteditorElement = document.getElementById("container");

        var container = documenteditorElement.ej2_instances[0];

        container.showPropertiesPane = true;

        documenteditor = container.documentEditor;

        documenteditorElement.ej2_instances[0].serviceUrl = "/api/DocumentEditor/";

        documenteditor.serviceUrl = "/api/DocumentEditor/";

        documenteditor.spellCheck.languageID = 1033 //LCID of "en-us";

        documenteditor.spellCheck.removeUnderline = false;

        documenteditor.spellCheck.allowSpellCheckAndSuggestion = true;

        titleBarDiv = document.getElementById('documenteditor_titlebar');

        initComponentAndWireEvent();

    }


Regards,

WK


8 Replies

CW Chua Wei Kiat February 21, 2022 12:45 PM UTC

Dear Sir,


May I have some update on this?


Regards,

WK



AE Ajithamarlin Edward Syncfusion Team February 21, 2022 02:10 PM UTC

Hi Chua,


We suspect that the spellcheck was not working properly at your end may be of the language ID mismatch or SpellCheck API is not configured in the Web services. You have to provide the same language ID in the startup.cs file in your web service setup.


To know more please refer the below documentation link.

https://ej2.syncfusion.com/aspnetcore/documentation/document-editor/spell-check/


Spell check needs server interaction  through web service to work as expected


Also please refer the sample from the below link , to know further about how to confiure the spellcheck functionality


https://github.com/SyncfusionExamples/EJ2-Document-Editor-Web-Services/tree/master/ASP.NET%20Core


Please let us know if you need any further assistance on this.


Regards,

Ajithamarlin 



CW Chua Wei Kiat February 21, 2022 02:29 PM UTC

Dear Ajithamarlin,


Yes, I did not set up the Server and Web Service but I am not sure how to do it.

I try to look at the github but still not very understan

Do you have any sample projects so I can have a look.


Regards,

WK



CW Chua Wei Kiat February 22, 2022 07:48 AM UTC

Dear Ajithamarlin,


Do you have any demo link for this spell check?

I did found your demo word editor but do not have the spell check feature.


Regards,

WK



AE Ajithamarlin Edward Syncfusion Team February 23, 2022 08:26 AM UTC

Hi Chua,



Document editor requires server-side interaction for the following services to work. other functionalities will work independently.


1.       Importing word documents.

2.       Paste with formatting.

3.       Spell checking the document contents.

4.       Restrict editing.


If you can work with C#, then we have to write Web API services either in Core or MVC platform, since document editor provides supports in ASP.NET MVC and CORE platforms.



Following Packages has to be installed platform-wise.



https://www.nuget.org/packages/Syncfusion.EJ2.WordEditor.AspNet.Core

 

  

https://www.nuget.org/packages/Syncfusion.EJ2.WordEditor.AspNet.Mvc5


  

https://www.nuget.org/packages/Syncfusion.EJ2.WordEditor.AspNet.Mvc4


  

For your reference, please refer the below GitHub source for document editor services.



https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices



https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices/tree/master/ASP.NET%20Core



https://github.com/SyncfusionExamples/EJ2-DocumentEditor-WebServices/tree/master/ASP.NET%20MVC



you can host the service in IIS and set the launched url to serviceUrl property of document editor container.



https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-web-deploy-when-publishing-with-visual-studio



Please refer the below documentation on service url.



https://ej2.syncfusion.com/react/documentation/api/document-editor/#serviceurl



containerInstance.serviceUrl = http://localhost:62869/api/documenteditor/

//set the hosted url



Once, you set the hosted url to serviceUrl of document editor container, all the Document editor functionalities will work properly.




Please refer the below sample for reference.


https://www.syncfusion.com/downloads/support/directtrac/general/ze/ASP.NET_Core-619132521




To use the spellcheck you need to add spellcheck and spellcheck by page in the DocumenteditorController.cs file


Also need
the dictionary file accordingly.


 

[AcceptVerbs("Post")]

        [HttpPost]

        [EnableCors("AllowAllOrigins")]

        [Route("SpellCheck")]

        public string SpellCheck([FromBody] SpellCheckJsonData spellChecker)

        {

            try

            {

                SpellChecker spellCheck = new SpellChecker(spellDictionary);

                spellCheck.GetSuggestions(spellChecker.LanguageID, spellChecker.TexttoCheck, spellChecker.CheckSpelling, spellChecker.CheckSuggestion, spellChecker.AddWord);

                return Newtonsoft.Json.JsonConvert.SerializeObject(spellCheck);

            }

            catch

            {

                return "{\"SpellCollection\":[],\"HasSpellingError\":false,\"Suggestions\":null}";

            }

        }

 

        [AcceptVerbs("Post")]

        [HttpPost]

        [EnableCors("AllowAllOrigins")]

        [Route("SpellCheckByPage")]

        public string SpellCheckByPage([FromBody] SpellCheckJsonData spellChecker)

        {

            try

            {

                SpellChecker spellCheck = new SpellChecker(spellDictionary);

                spellCheck.CheckSpelling(spellChecker.LanguageID, spellChecker.TexttoCheck);

                return Newtonsoft.Json.JsonConvert.SerializeObject(spellCheck);

            }

            catch

            {

                return "{\"SpellCollection\":[],\"HasSpellingError\":false,\"Suggestions\":null}";

            }

        }

 



Please let us know if you need any further assistance



Regards,

Ajithamarlin E



CW Chua Wei Kiat February 24, 2022 08:26 AM UTC

Dear Sir,


I hosted the service in the IIS express.




and point the service URL to the http://localhost:62869/api/documenteditor/ in the view/documenteditor.

the documenteditor is working fine but the spellcheck is not firing.




May I know the App_Data contains the .dic file should place it in the dot net core project or the web service project?


I attached my project for your reference.

You may download my project from the below dropbox link.

https://www.dropbox.com/sh/8cg3euk78wtdl4k/AABoUqJ0qPsJ3Ip7h_AJiidEa?dl=0


Regards,

WK



CW Chua Wei Kiat February 24, 2022 09:06 AM UTC

Dear  Ajithamarlin,


It is working fine now!



Thanks for your help.


Regards,

WK



AE Ajithamarlin Edward Syncfusion Team February 25, 2022 02:30 PM UTC

Hi Chua,


Thanks for the update.


Regards,

Ajithamarlin E


Loader.
Up arrow icon