EJ2 Webservices in java for WordEditor written in Java Spring Boot.
To run
gradlew bootRun
- Import
- SystemClipboard
- RestrictEditing
- Export
- SpellCheck
In order to import word documents into document editor you can make use of this service call. Also you can convert word documents (.dotx,.docx,.docm,.dot,.doc), rich text format documents (.rtf), and text documents (.txt) into SFDT format by using this Web API service implementation.
You can make use of this service in order to paste system clipboard data by preserving the formatting.
Document Editor provides support for restrict editing. You can make use of this Web API service to encrypt/decrypt protected contnt.
Document Editor provides support to convert (.Docx / .SFDT) to other file formats such as (DOC, RTF, HTML, WordML, Txt) in the server-side. You can make use of below WebAPI methods to achieve this behavior.
You can make use of this Web API method (Export) to convert .Docx to other format types which are supported in Syncfusion DocIO library. You can refer this to know more about supported conversion types. Converted file will be sent to the client side for download.
You can make use of this Web API method (ExportSFDT) to convert .SFDT to other format types which are supported in Syncfusion DocIO library. You can refer this to know more about supported conversion types. Converted file will be sent to the client side for download.
You can make use of this Web API method (Save) to convert .SFDT to other format types which are supported in Syncfusion DocIO library. You can refer this to know more about supported types. Since on exporting, SFDT informations are passed to the DocIO library using syncfusion-ej2-wordprocessor.jar so we may encounter few elements missing in the exported file due to unsupported features.
Document editor performs spell check by processing hunspell dictionary files, So kindly follow below steps to include the necessary files to perform spell check.
Hunspell Dictionaries - Dictionary location
- In the application resource folder, include the dictionary, .aff dictionary files and JSON file.
JSON file should contains the values in the following format.
[
{
"LanguadeID": 1036,
"DictionaryPath": "fr_FR.dic",
"AffixPath": "fr_FR.aff",
"PersonalDictPath": "customDict.dic"
},
{
"LanguadeID": 1033,
"DictionaryPath": "en_US.dic",
"AffixPath": "en_US.aff",
"PersonalDictPath": "customDict.dic"
}
]-
For handling personal dictionary, place empty .dic file (ex. customDict.dic file) in the resource folder.
-
Parse the JSON file before spell checker service call to provide the dictionary and affix path information to syncfusion-ej2-spellchecker Java library.

- Spell checking will be performed based on the below information from client side and it will be passed to getSuggestions API to process spell checker.
- As mentioned document editor supports multi-language spell check. You can add as many languages (dictionaries) using DictionaryData class with unique ID for each language. Spell checking will be initiated only when languageID value passed in client side present in the DictionaryData collection.
- The text to be processed for spell checking.
- Indicates spell checking need to be performed for the given text.
- Indicates whether to provide suggestions for the mis-spelled words.
- Indicates whether the text need to added in personal dictionary.
Cross-Origin Resource Sharing (CORS) is a protocol that enables scripts running on a browser client to interact with resources from a different origin. In the client side we can make only API calls to the URLs that live in the same origin where the script is running or else it will be blocked as per Same-Origin policy
When the server configured correctly to allow cross-origin resource sharing some special headers will be included in the response. Based on that browser will determine to proceed with the request or should fail.
You can enable CORS per action, per controller, or globally for all Web API controllers in your application. Kindly follow below steps to achieve it.
Enable CORS for the whole application be declaring WebMvcConfigurer bean
Configure WebAPI methods / Controller class to access from all the domains as below,
Controller Level
Method Level
Configure WebAPI methods / Controller class to access from specific domains as below,
Controller Level
Method Level
NOTE
Java Web Service project has already been configured with CORS origin in all the WebAPI methods.