|
|
#1 |
|
Участник
|
palleagermark: Spell checking from AX
Источник: http://palleagermark.blogspot.com/20...g-from-ax.html
============== The AX class SysSpellChecker is a wrapper for the spellchecker of Word. Using this class you can offer spellchecking from AX. Here is some sample code, checking text from a form string control: X++: SysSpellChecker spellChecker = SysSpellChecker::newCurrentLanguage();
TextBuffer textBuffer = new TextBuffer();
int wordStart;
int startSeparator;
int endSeparator;
str wordToCheck;
List spellingSuggestions;
ListEnumerator listEnumerator;
;
super();
startLengthyOperation();
setPrefix("Spell check");
textBuffer.setText(stringEdit.text());
startSeparator = 1;
while (startSeparator)
{
wordStart = textBuffer.find('[^ \n\t\\!\\'\\\#\%\&\/\(\)\=\?\,\.\:\;\*\}\{\|]', startSeparator) ? textBuffer.matchPos():0;
if (!wordStart)
break;
endSeparator = textBuffer.find('[ \n\t\\!\\'\\\#\¤\%\&\/\(\)\=\?\,\.\:\;\*\}\{\|]', wordStart)? textBuffer.matchPos():0;
wordToCheck = textBuffer.subStr(wordStart, (endseparator ? endseparator : textBuffer.size()+1) - wordStart);
if (spellChecker.checkSpelling(wordToCheck) == false)
{
warning (strfmt("@SYS84009", wordToCheck));
spellingSuggestions = spellChecker.getSpellingSuggestions(wordToCheck);
listEnumerator = spellingSuggestions.getEnumerator();
while (listEnumerator.moveNext())
{
info (strFmt("Suggestion: %1", listEnumerator.current()));
}
}
startSeparator = endSeparator;
}
spellChecker.finalize();
info ("Spell check done");
endLengthyOperation();Источник: http://palleagermark.blogspot.com/20...g-from-ax.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|
|
|