OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Change formula BaseFontHeight through macro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
msorc
General User
General User


Joined: 07 Jul 2003
Posts: 8
Location: Ukraine

PostPosted: Mon Jan 26, 2004 9:36 am    Post subject: Change formula BaseFontHeight through macro Reply with quote

Hi!

I need to change the font size of all formulas in text. Searching the forum I didn't find any solution except one - change the size manually for each math item.

So, I guess one can make it by macro. I think it should look like this:
1. Locate each math object
2. Open it, and change font size.
I'm not a basic expert, so any suggestions(with listings) would be higly appreciated.

If it's impossible may we can go another way Smile
I've tried one lame solution. I have changed the value of BaseFontHeight in each math Obj*/settings.xml to the desired value. But the frame size left unchanged and I had again to just open and close each math object to let it redraw itself.

Thanks a lot for any suggestions.
Back to top
View user's profile Send private message
msorc
General User
General User


Joined: 07 Jul 2003
Posts: 8
Location: Ukraine

PostPosted: Sun Feb 01, 2004 2:58 am    Post subject: Reply with quote

Sub Formulator
Dim Doc As Object
Dim objects As Object
Dim obj As Object
Dim embedded As Object
Dim formula As String
Dim newFontSize As Integer

newFontSize = InputBox("New formula font size:", "BaseFontHeight", 14)

' Create document object
Doc = StarDesktop.CurrentComponent

' get objects
objects = Doc.getEmbeddedObjects()

' loop over all objects
For i = 0 to objects.count-1
obj = objects(i)
embedded = obj.getEmbeddedObject()

If embedded.supportsService("com.sun.star.formula.FormulaProperties") Then
embedded.BaseFontHeight = newFontSize
' some tricks to force OO.o redraw formulas
formula = embedded.Formula
embedded.Formula = ""
embedded.Formula = formula
End If

Next i

doc.reformat()

End Sub
Back to top
View user's profile Send private message
kotsopoulos
Newbie
Newbie


Joined: 11 Feb 2005
Posts: 1

PostPosted: Fri Feb 11, 2005 6:27 am    Post subject: formula global font size change macro Reply with quote

Great macro but it seems that it only works in writer and not in the drawing or presentation package.

Is there a possible modification that will fix that?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group