AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 04.04.2008, 10:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
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();
Unfortunately there is a bug in the checkSpelling method of the COM object from Word, so it will always use your default language of your Office setup as the language to check your text again. So you can't spellcheck for other languages than you default language of Office. You can change the default language from the Office Tools.


Источник: http://palleagermark.blogspot.com/20...g-from-ax.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
palleagermark: Creating an image file based on plain text from AX Blog bot DAX Blogs 0 03.03.2009 03:08
palleagermark: Channel 9 video: Dynamics AX Version Control interview from Convergence in Copenhagen 2008 Blog bot DAX Blogs 0 30.01.2009 16:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Arijit Basu: AX 2009 - Quick Overview Blog bot DAX Blogs 4 19.05.2008 14:47
Malaysia: Spell checking from AX Blog bot DAX Blogs 0 15.05.2008 22:05
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 17:34.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.