Logic for Spell Checking

Today I will demonstrate you that how to write logic for Spell Checking in AX 2012.

static void SpellChecker(Args _args)
{
SysSpellChecker sysSpellChecker;
container spellings;
ListEnumerator listEnumerator;
List spellingsSuggestions;
int i;
spellings = ['Tble', 'Comput', 'Mcrosft', 'Rlease'];

// Construct the sysSpellChecker object.
sysSpellChecker = SysSpellChecker::newCurrentDocumentationLanguage();
startLengthyOperation();

for(i=1; i<= conlen(spellings); i++)
{
if(! sysSpellChecker.checkSpelling(conpeek(spellings, i)))
{
spellingsSuggestions = sysSpellChecker.getSpellingSuggestions(conpeek(spellings, i));
listEnumerator = spellingsSuggestions.getEnumerator();
info(strFmt(“Suggested Spellings for: %1",conpeek(spellings, i)));
while(listEnumerator.moveNext())
{
info(strFmt("%1",listEnumerator.current()));
}
}
}
sysSpellChecker.finalize();
info(“Spell checking is Done”);
endLengthyOperation();
}

Comments