Liquid UI - Documentation - 16.06 Word spell checker

16.06 Word spell checker


Prerequisites


Purpose

In this article, you will learn how to integrate Word Spell Checker to verify the text entered within a long text control created in SAP GUI using Liquid UI.

To integrate a word spell checker, please do the following

  1. Load wsoffice.dll file
  2. Create a box, textbox, and push button to enter the text for spell check
  3. Add a function to process the spell check


User Interface

//Create this file inside your script folder for integrating the word spell checker. zguixt.e0100.sjs

//Now, let's start adding the Liquid UI script to the above file and save it.

  1. Load wsoffice.dll Load wsoffice.dll in the ESESSION.sjs file and save it.
    // wsoffice.dll is required to be installed
    load('wsoffice'); 
  2. Add a box, textbox, and pushbutton.

    Create a box with the label “Spelling Check-MS Word Automation”. A longtext control textbox with the label “sample text”. And a pushbutton "MS Word Spell Check" to initiate the spellcheck process, as shown below.

    // create a group box Spelling Check
    box([1,0], [12,72], "Spelling Check - MS Word Automation");
    //create a textbox to enter the text textbox([2,1],[11,71],{'name':'sampletext'});
    //create a pushbutton to execute spellCheck process pushbutton([13,0],'@3V@MS Word Spell Check',{'process':spellCheck});

     
  3. Add a function to perform the spell check
    // Sample Function
    function spellCheck() {
        var myWord = new ActiveXObject('Word.Application');

        myWord.Caption = "Spell Check";
        myWord.Visible = true;

        var doc = myWord.Documents.Add();
        doc.Activate();
        doc.Content.Text = sampletext;
        doc.CheckSpelling();

        newText = doc.Content.Text;
        doc.Saved = false;
        doc.Close(0);
        doc = null;

        myWord.Quit();
        myWord = null;

        onscreen '*'
            copytext({'fromstring':'newText', 'totext':'sampletext'});
            enter('?');

    }


SAP Process

  1. Logon to SAP, on the SAP Easy Access screen you can see a box labeled “ Spelling check - MS Word Automation” and a long textbox labeled “sampletext”. Now, enter the text in the textbox and click on the push button, as shown below.
     
     
  2. Click on the pushbutton “MS Word Spell check” opens up the word spell checker showing suggestions for all the misspelled words in the text entered. Select the correct word from the suggestions and click on any one of the options ‘Change’ or ‘Change All’ or ‘AutoCorrect’ to apply the changes. Corrected words get replaced and the next wrong word to be corrected is highlighted with suggestions, as shown below.

     
  3. After correcting all the misspelled words, edited text is updated on the SAP screen, as shown below.
     
     

Can't find the answers you're looking for?