Ask Your Question
0

Automatically change the font of all text boxes in Impress

asked 2018-02-13 13:49:13 +0100

Erel Segal-Halevi gravatar image

I received a PowerPoint presentation from a colleague. I converted it to Impress. The presentation uses a font that takes a lot of time to load. I want to change it to a different font. Do I have to make the change in each and every text-box? Or is there a way to change all fonts at once?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2018-02-13 16:56:15 +0100

librebel gravatar image

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

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-02-13 13:49:13 +0100

Seen: 22 times

Last updated: Feb 13