0

I am writing an AddIn PowerPoint. I am using PowerPoint 2013, C#, Visual Studio 2013.

When I open an existing presentation which is created and modified on another computer (e.g., Mac or Linux), some texts in non-standard true type fonts prevent me from saving the presentation.

error

So my question is

1) Is it possible to catch and handle this error in code?

2) Or is there any way to check whether a presentation contains some non-standard font?

Thanks

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
chipbk10
  • 5,783
  • 12
  • 49
  • 85

1 Answers1

0

Nothing's preventing you from saving the presentation as such; the message is telling you that because the presentation uses fonts that are not embeddable, you cannot save the presentation with the fonts embedded.

You can look at the presentation's .Fonts collection and determine for each font whether it's embeddable or not:

Sub FontList()
    Dim x As Long
    With ActivePresentation.Fonts
        For x = 1 To .Count
            Debug.Print .Item(x).Name & vbTab & .Item(x).Embeddable
        Next
    End With
End Sub

If you find unembeddable fonts, you could opt to save the presentation w/o embedding fonts (third parameter to SaveAs set to False rather than True).

Or probably more practically, use the .Fonts.Replace to substitute a different font (one that IS embeddable). I expect you'd have to create your own replacement table for this; if the font's not present on your system, Windows will have substituted another font, but PPT won't tell you what font it is.

Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34
  • Thanks for your answer. I do the same as your approach, but still cannot save the presentation. More in details: I check on font "Gills Sans Light", and this font in code is embeddable, but it still prevents from saving, and ends up showing that the "Gills Sans Light" is not true type as you saw in the picture. It seems to be a bug from Powerpoint itself when PowerPoint cannot detect this font as "not embeddable" – chipbk10 Apr 30 '15 at 08:58
  • Do you have multiple versions of Gill Sans Light on the system, perhaps? It's supplied by several different font foundries in several different formats. Multiple versions might cause problems. Or suppose I use Gill Sans Light in one non-embeddable format from Adobe, for example. I send you the file, you've got Gill Sans Light in TT format so Windows substitutes that, but when it comes to saving, PPT's unable to embed the actual used font because it's not on the system. Or t'other way around; the substituted font is PS, which can't be embedded. – Steve Rindsberg Apr 30 '15 at 15:35
  • So, what do I have to do? – chipbk10 May 04 '15 at 08:31
  • If the presentation has to be distributed to other people, use only install-embeddable fonts or better, use only fonts that will be common to all systems so you don't need to embed fonts at all. – Steve Rindsberg May 04 '15 at 13:54