Ask Your Question
0

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 http://api.libreoffice.org/docs/idl/r... , 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
0

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

pierre-yves samyn gravatar image

Hi

You can try something like:

dim region as object
dim oLocalSettings As New com.sun.star.lang.Locale

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

Comments

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

Stats

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

Seen: 120 times

Last updated: Jun 25 '15