Hello Xiang,

Basically the macro listed in the posting at the end of this one is
correct. I just needed to change one line to get it working.

It looks like this now:

========================

Sub Main

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 = ThisComponent

' 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
        endif

next i

'doc.reformat() ' also not needed anymore in OOo 3.0

End Sub

========================

Please note that those 'extra tricks' in the original macro to get the
formula redrawn when just changing the font size (or some other
property) is no longer needed since OOo 3.0 Beta.

Also we hat two related but separate regression issues that prevented
the automatic update of programmatically changed formulas. Those as well
are fixed in OOo 3.0 Beta.
I just checked the macro above with DEV300 m26 build and it works just fine.

Thus I suggest you download the latest OOo 3.0 Beta or wait for the
final release and everything should be ok.


Regards,
Thomas




Thomas Lange - Sun Germany - ham02 - Hamburg wrote:

> Hi Xiang,
> 
>> Can I change the font size of all existed equations in writer, not
>> individually?
>> 
>> I have tried to set the default font size in Format-->font size, but It only
>> apply for new formulas.
> 
> If you want to change formulas within Witer you may try the macro listed
> here:  http://www.oooforum.org/forum/viewtopic.phtml?t=5190
> 
> Regards,
> Thomas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to