Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello @Erel Segal-Halevi,

To change the Font for all Slides in the current Impress document, you could use the following macro:

  1. Just copy-paste the below macro into your [My Macros].Standard Basic Macro library;
  2. set the name of your preferred Font inside the macro itself ( currently it is set to Times New Roman );
  3. then open the Impress document whose Font to change;
  4. then run the macro by choosing the menu Tools : Macros : Run Macro... and browse to the macro named Impress_Update_Font() and click the button Run.

code:

Sub Impress_Update_Font()
REM Updates the Font for all Slides in the current Impress document.
REM All other Font properties such as Size, Color, etc., are left intact.

    Const strNewFontName As String  = "Times New Roman" REM <-- Preset your preferred Font Name here.

    Dim oDoc As Object  :   oDoc = ThisComponent
    If oDoc.SupportsService( "com.sun.star.presentation.PresentationDocument" ) Then

        Dim oSlides As Object   :   oSlides = oDoc.getDrawPages()
        Dim oSlide As Object
        Dim oShape As Object
        Dim i As Integer, j As Integer

        On Error Resume Next
        For i = 0 To oSlides.getCount() - 1
            oSlide = oSlides.getByIndex( i )
            For j = 0 To oSlide.getCount() - 1
                oShape = oSlide.getByIndex( j )
                oShape.CharFontName = strNewFontName
            Next j
        Next i
    End If
End Sub

HTH, lib