Ask Your Question

Writer Basic: How to set text locale to None

asked 2018-10-10 11:27:42 +0100

Matvej gravatar image

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 
Dim i As Long
oLoc.Language = ""
oSrchDescr = ThisComponent.createSearchDescriptor()
oSrchDescr.SearchRegularExpression = True
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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-10-10 11:42:07 +0100

As you could find out by inserting a command like print oNextText.CharLocale.Language before oNextText.CharLocale = oLoc, and running this through a document with language preset to "None", this is "zxx" (see ISO 639).

edit flag offensive delete link more


"zxx" works, but it is really strange. Anyway Thank you.

Matvej gravatar imageMatvej ( 2018-10-10 11:57:12 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-10-10 11:27:42 +0100

Seen: 23 times

Last updated: Oct 10 '18