# Automatically change the font of all text boxes in Impress

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 close merge delete

Sort by » oldest newest most voted

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

more