Hello,
How do I get() / set() the Language for a text range ?
Thanks in advance.
objParagraph.ParaStyleName = "My Spanish Text Body"
REM ***** BASIC *****
sub Main
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 ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Language"
args1(0).Value = "Paragraph_Danish"
dispatcher.executeDispatch(document, ".uno:LanguageStatus", "", 0, args1())
end sub
msgbox (paraPortion.CharLocale.Language)
REM paraPortion is the variable to which you assign the elements of the enumeration
REM The Language field of the Locale structure is a string, see com.sun.star.lang.locale
paraPortion.CharLocale.Language = "en"
paraPortion.CharStyleName = "myCharStyleEn"
nunof32 wrote:[In case you are wondering : I needed to do all this to amend a bunch of files created in MS WORD and then save them as OpenOffice/Writer documents. For some reason, those MS WORD files had some paragraphs where different Language attributes had been used all along (do not ask, I do not know why). I did try to assign to the whole document a Paragraph Style that had English has its Language attribute but that had no effect on the Language attribute of the paragraph portions that had another Language assigned to them.]
Sub ResetLanguage
dim document as object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Language"
args1(0).Value = "Current_RESET_LANGUAGES"
dispatcher.executeDispatch(document, ".uno:LanguageStatus", "", 0, args1())
End Sub
Users browsing this forum: No registered users and 2 guests