Read the section titled


Setting The Locale


in my free macro document... The code looks like this:

Sub SetDocumentLocale
 Dim oCursor
 Dim aLocale As New com.sun.star.lang.Locale
 aLocale.Language = "fr"
 aLocale.Country = "FR"

REM This assumes a text document
REM Get the Text component from the document
REM Create a Text cursor
oCursor = ThisComponent.Text.createTextCursor()
REM Goto the start of the document
REM Then, goto the end of the document selecting ALL the text
oCursor.GoToStart(False)
Do While oCursor.gotoNextParagraph(True)
oCursor.CharLocale = aLocale
oCursor.goRight(0, False)
Loop
Msgbox "successfully francophonized" End Sub




Herbert Eppel wrote:

I started experimenting with macros, and I tried a very simple macro for setting the language - all it does is "Select All", then set the language to German via the Character menu (see below).

However, it does not work, i.e. when I run the macro, the Character menu stays open, and the language remains set to the default language :-(

Is it a bug?
Am I doing something wrong?

Thank you.

Herbert Eppel
www.HETranslation.co.uk

**************************************************************

sub GE
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")


rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())


rem ----------------------------------------------------------------------
dim args2(0) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Language"
args2(0).Value = 1031


dispatcher.executeDispatch(document, ".uno:Language", "", 0, args2())


end sub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm Free Info: http://www.pitonyak.org/oo.php


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to