8850

How to check whether the presentation contains some non-standard font?

Question:

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.

<img alt="error" class="b-lazy" data-src="https://i.stack.imgur.com/scyl6.png" data-original="https://i.stack.imgur.com/scyl6.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

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

Answer1:

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.

Recommend

  • blackberry “error file is not a valid java code file”
  • Encrypt file with AES-256 and Decrypt file to its original format
  • Extract the file name from filename with path which comes from argument
  • Can't find pipeline editor anymore
  • Using python to determine if a timestamp is under daylight savings time
  • Uploading image using SpringMVC 4.0 Multipart
  • Teradata Database 3130 Response limit exceeded?
  • Font Awesome in Viewpager Previous Next
  • Eclipse dark color theme fixes
  • How to retrieve a specific string from a specific list from a file with JSON in Python
  • Is it possible to “shrink” a PdfPtable?
  • Changing media screen makes div overlay
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • C#: Import/Export Settings into/from a File
  • Bash if statement with multiple conditions
  • Tamper-proof configuration files in .NET?
  • How can I set a binding to a Combox in a UserControl?
  • AJAX Html Editor Extender upload image appearing blank
  • Converting a WriteableBitmap image ToArray in UWP
  • Content-Length header not returned from Pylons response
  • Django rest serializer Breaks when data exists
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Ajax Loaded meta Tags
  • How to rebase a series of branches?
  • Xamarin Forms - UWP Fonts
  • Why value captured by reference in lambda is broken? [duplicate]
  • Azure Cloud Service Web Role web pages do not load
  • javascript inside java/jsp code
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • In LanguageTool, how do you create a dictionary and use it for spell checking?
  • what is the difference between the asp.net mvc application and asp.net web application
  • Arrays break string types in Julia
  • Acquiring multiple attributes from .xml file in c#
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Linking SubReports Without LinkChild/LinkMaster
  • How can I remove ASP.NET Designer.cs files?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • java string with new operator and a literal