Hi Friends! I'm a newbie to OOo Writer (using v3.2 on WinXP)
I tried everything to record a VB macro that might let me change a preset paragraph (or character) style:
I've got some text set in "myStyle" style which is set "black", I don't mean to change directly the text style or property, but I wish to change "myStyle"'s colour property to "red" through a macro (I'll link to a button; another button will link a similar Macro doing the contrary: a fast way to switch view)
Recording a Macro I get this code:
...
args1(0).Name = "Param"
args1(0).Value = "myStyle"
args1(1).Name = "Family"
args1(1).Value = 1
dispatcher.executeDispatch(document, ".uno:EditStyle", "", 0, args1())
...
but running it just allows me to open the Edit Style Dialog Window, it seems it cannot record any setting..
I guess I need to complete the code manually by mysef somehow:
May you help me to get a sample VB code to change properties of a named Style through a Macro?
Thanks anybody for your time,
Vittorio (Italy)
[Solved] Editing Style Properties through VB Macro
[Solved] Editing Style Properties through VB Macro
Last edited by Hagar Delest on Fri Feb 26, 2010 10:42 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OOo 3.2 on MS Windows XP
Re: Editing Style Properties through VB Macro
You've got to program utilizing the UNO API. Dispatches from the macro recorder do not help.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Editing Style Properties through VB Macro
yes, I feared that, please could you post here any raw code (e.g.for editing a "paragraph style property") as an example I can start from?You've got to program utilizing the UNO API
I would greatly appreciate
Thanks again,
V.
OOo 3.2 on MS Windows XP
Re: Editing Style Properties through VB Macro
http://www.oooforum.org/forum/search.phtml enter "stylefamilies" and get 163 results.
This forum has another 40 hits.
This forum has another 40 hits.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Editing Style Properties through VB Macro
Many THANKS to Villeroy for the useful link and the "magic" little word to search (it was just what I missed)!
I would suggest to anyone interested also:
- http://wiki.services.openoffice.org/wik ... nformation (great reference link list, particularly the ODT manual http://www.pitonyak.org/AndrewMacro.odt)
- http://api.openoffice.org/docs/common/r ... ttomBorder (for official detail reference)
Finally I wish to feed this forum posting my own new-born solution to the above mentioned matter:
it does EXACTLY the switching I meant!
P.S. Just arrived to OOo, but it really looks GREAT
My Best Regards and thanks once again,
Vittorio (Italy)
I would suggest to anyone interested also:
- http://wiki.services.openoffice.org/wik ... nformation (great reference link list, particularly the ODT manual http://www.pitonyak.org/AndrewMacro.odt)
- http://api.openoffice.org/docs/common/r ... ttomBorder (for official detail reference)
Finally I wish to feed this forum posting my own new-born solution to the above mentioned matter:
Code: Select all
sub Stampa
Dim oStileCar,oStilePar
oStileCar=thisComponent.StyleFamilies.getByName("CharacterStyles").getByName("VitCar")
oStilePar=thisComponent.StyleFamilies.getByName("ParagraphStyles").getByName("VitStile")
dim bordo as New com.sun.star.table.BorderLine
If oStileCar.CharColor=13421772 Then rem STAMPA
oStileCar.CharColor=16777215
bordo.Color=0
bordo.OuterLineWidth=0
Else rem NO STAMPA
oStileCar.CharColor=13421772
bordo.Color=15132390
bordo.OuterLineWidth=2
End If
oStilePar.BottomBorder=bordo
rem Print oStilePar.BottomBorder.Color
rem 13421772 GRIGIO CHIARO
rem 16777215 BIANCO
rem 15132390 GRIGIO CHIARISSIMO
rem 0 NERO
end sub
P.S. Just arrived to OOo, but it really looks GREAT
My Best Regards and thanks once again,
Vittorio (Italy)
OOo 3.2 on MS Windows XP
Re: [Solved] Editing Style Properties through VB Macro
Hi
Please help me to write little macro in OpenOffice Basic, because I know just how to use macros recorder, not to programming it.
I'm just need change paragraph justification in style "MyBasic" to both border through macro.
Thanks, and sorry for my english.
Please help me to write little macro in OpenOffice Basic, because I know just how to use macros recorder, not to programming it.
I'm just need change paragraph justification in style "MyBasic" to both border through macro.
Thanks, and sorry for my english.
OpenOffice 3.2.1 on Windows 7
- Hagar Delest
- Moderator
- Posts: 32655
- Joined: Sun Oct 07, 2007 9:07 pm
- Location: France
Re: [Solved] Editing Style Properties through VB Macro
Look at the Macro forum, there is a sticky with links to documentation. Or search for a similar topic with a code snippet.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10