How to change the font of all equations in LibreOffice Writer

libreoffice-writer

Is there a way to quickly change the font of all equations in a document? Maybe there's a built-in style for them or something…

I don't want to set a default style for new ones, but to change existing one's.

Best Answer

I don't believe there is a built-in style for the formulas. However, you can have a macro iterate over all formulas and change the style. The French OpenOffice.org FAQ has an example of such a macro:

Sub Main
    embeddedObjects = ThisComponent.getEmbeddedObjects()
    elementNames = embeddedObjects.getElementNames()
    for i=0 to UBOUND(elementNames)
        element = embeddedObjects.getByName(elementNames(i)).Model
        if (not isNull(element)) then
            if (element.supportsService("com.sun.star.formula.FormulaProperties")) then
                element.BaseFontHeight = 14
                element.FontNameVariables= "Arial"
                element.FontNameFunctions = "Arial"     
                element.FontNameNumbers= "Arial"        
                element.FontNameText= "Arial"       
            endif
        endif
    next i
    ThisComponent.reformat()
End Sub
Related Question