From The Document Foundation Wiki
    < API‎ | Samples‎ | StarBasic
    Snippet: SpellChecking.BAS
    Description: Illustrate the use of the spellchecker to know if a word is valid.
    Programming Language: StarBasic
    Author: Laurent Godard , 2007
    License: LGPL

    Sub Main
    ' Selects the language
    dim locale as new com.sun.star.lang.Locale
    locale.Language="fr" 'ISO 639
    locale.Country="FR"  'ISO 3166
    ' Get the service
    LinguService = createUnoService("com.sun.star.linguistic2.LinguServiceManager")
    spellChecker = LinguService.getSpellchecker()
    msgbox "is dictionary detected ? " +chr(10)+ spellChecker.hasLocale(locale)
    word = inputbox("File to check (empty for end) ?")
    while word<>""
    	isWordValid = spellChecker.isValid(word, locale, array())
    	if isWordValid then
    		msgbox word + " is valid"
    		msgbox word + " is NOT valid"
    	word = inputbox("File to check (empty for end) ?")
    End Sub

    Apache Feather Logo.svg

    This work is licensed under the Apache License version 2.0