Ask Your Question

How do I set the locale of the current selection

asked 2015-06-25 09:33:34 +0200

Richard Wordingham gravatar image

I'm trying to set the locale of selected text in writer? I can't use the pick list because the text has a complex text layout, and the locale is not in the pick list. At present the only method I have that works is to edit the underlying XML by hand.

I've been told that the key information is in , but I can't work out how to set the fields. My best efforts are:

dim region as object
region = ThisComponent.CurrentSelection.getByIndex(0)
region.Variant  ="khb-CN"
region.Locale.Language ="qlt"

However, neither the object designated by region has neither property Variant nor property Locale, so the code fails with an appropriate error message.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-06-25 10:48:52 +0200

pierre-yves samyn gravatar image


You can try something like:

dim region as object
dim oLocalSettings As New

with oLocalSettings
'   .Country = ?'
    .Language = "qlt"
    .Variant = "khb-CN"
end with

region = ThisComponent.CurrentSelection.getByIndex(0)
region.CharLocale = oLocalSettings

As you can see it is possible to also define the country... Regards

edit flag offensive delete link more


Excellent! Incidentally, if using it for a complex script such as 'Old Tai Lue', one uses CharLocaleComplex. I've no idea which one should use for New Tai Lue - last month it was a complex script, this month it ceased to be complex.

Richard Wordingham gravatar imageRichard Wordingham ( 2015-06-25 21:49:14 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-06-25 09:33:34 +0200

Seen: 120 times

Last updated: Jun 25 '15