| View previous topic :: View next topic |
| Author |
Message |
msorc General User

Joined: 07 Jul 2003 Posts: 8 Location: Ukraine
|
Posted: Mon Jan 26, 2004 9:36 am Post subject: Change formula BaseFontHeight through macro |
|
|
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
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 |
|
 |
msorc General User

Joined: 07 Jul 2003 Posts: 8 Location: Ukraine
|
Posted: Sun Feb 01, 2004 2:58 am Post subject: |
|
|
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 |
|
 |
kotsopoulos Newbie

Joined: 11 Feb 2005 Posts: 1
|
Posted: Fri Feb 11, 2005 6:27 am Post subject: formula global font size change macro |
|
|
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 |
|
 |
|