How can I check the spelling of the value of a cell?

In Calc, I want to test whether a text (such as the content of a cell or the result of a formula) has correct spelling according to the dictionary in use. Is this possible?

Effectively, I need to emulate a function like Isspell(text,language) with the 2nd parameter optional
So in UKEnglish, Isspell(“a” & B1) would be true if cell B1 contained " cow" or “n” but not “cow” or “z”
LO must generate a similar property in order to underline spelling errors.

1 Like

not sure how related it can be : tdf#140618 @KamilLanda ?

maybe uno:SpellCheckApplySuggestion too.

1 Like

The bug isn’t related, bug is only non functional Tools > Automatic Spellchecking called with macro.

Something like this? The word in cell A1 and function for example in B1 → =ISSPELL(A1, “en”) or =ISSPELL(A1) (“en” is default)

Function ISSPELL(s$, optional sCountry$) 'check the text from the cell in spellchecker
	if isMissing(sCountry) then sCountry="en" 'missing country in parameters
	const cLang="UK"
	const cDict="standard.dic"

	dim oSpeller as object, oDics as object, oDic as object, oLoc as new com.sun.star.lang.Locale
	oSpeller=createUnoService("com.sun.star.linguistic2.SpellChecker") 'spellchecker
	oDics=createUnoService("com.sun.star.linguistic2.DictionaryList") 'list of the dictionaries
	oDic=oDics.getDictionaryByName(cDict) 'use the dictionary
	with oLoc
		.Language=cLang
		.Country=sCountry
	end with
	if s="" OR NOT oSpeller.isValid(s, oLoc, array())  then 'empty or no-valid string
		ISSPELL="false"
	else
		ISSPELL="true"
	end if
End Function

always true :tired_face:

Sorry, I tested it only with cs_CZ dictionary and then only rewrited strings to en, UK. I haven’t installed en dictionaries :frowning: