Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Writer Basic: How to set text locale to None

I want to avoid spellchecking of some words/phrases in my doc. I want to use macro like this:

Sub setNoLangToSpecificText(sSpecificText As String)
Dim oSrchDescr As Variant
Dim aFound As Variant
Dim oNextText As Variant
Dim oLoc As New com.sun.star.lang.Locale 
Dim i As Long
oLoc.Language = ""
oSrchDescr = ThisComponent.createSearchDescriptor()
oSrchDescr.SearchRegularExpression = True
oSrchDescr.setSearchString(sSpecificText)
aFound = ThisComponent.findAll(oSrchDescr)
For i = 0 To aFound.getCount() - 1
    oNextText = aFound.getByIndex(i)
    oNextText.CharLocale = oLoc
Next i

End Sub

What should I assing to oLoc.language to set the text's language to "None (Do not check spellig)" When I assing empty string "", it will use Default locale.