MATLAB Answers

Manipulating PowerPoint Custom Document Properties Using ActiveX

58 views (last 30 days)
John Feiereisen
John Feiereisen on 11 Dec 2020
Commented: John Feiereisen on 14 Dec 2020
My organization requires certain markings to be included in Office documents when saving, printing, etc., and I believe these markings are stored as custom document properties. There is a PowerPoint add-in that adds these for us via a GUI. However, I am using ActiveX to generate presentations, add figures, etc. and when saving the file the GUI pops up and stops everything, waiting for user input. I'd like to add all the required markings programmatically to avoid the GUI popping up. First I need to see what all the markings are, then I need to figure out how to set them in virgin presentations so they're completely compliant with policy.
I have Powerpoint files I created in PowerPoint that are identical, except one is marked and the other is not. The unmarked one has 1 custom document property. The marked one has 11 custom document properties. I can see the number of properties, but I can't figure out how to see what those properties are named, what their values are, or how to add new properties. How do I do this?
Thanks.
No markings:
>> pres = ppt.Presentations.invoke('Open',fullfile(pwd,'nomarking.pptx'));
>> CustDocProps = pres.CustomDocumentProperties;
>> get(CustDocProps)
Parent: [1×1 Interface.9149349D_5A91_11CF_8700_00AA0060263B]
Count: 1
Application: 'Invoke Error, Dispatch Exception: Unspecified error←↵'
Creator: 1.3479e+09
Yes markings:
>> pres = ppt.Presentations.invoke('Open',fullfile(pwd,'yesmarking.pptx'));
>> CustDocProps = pres.CustomDocumentProperties;
>> get(CustDocProps)
Parent: [1×1 Interface.9149349D_5A91_11CF_8700_00AA0060263B]
Count: 11
Application: 'Invoke Error, Dispatch Exception: Unspecified error←↵'
Creator: 1.3479e+09

Answers (1)

Sean de Wolski
Sean de Wolski on 11 Dec 2020
You should strongly consider using the MATLAB Report Generator to generate the presentations. It lets you use existing templates and dynamically add content as necessary.
  1 Comment
John Feiereisen
John Feiereisen on 14 Dec 2020
I already have a library of codes for manipulating PowerPoint presentations that we have been using for years. All it's missing is adding these CustomDocumentProperties (a relatively new requirement in my organization).

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by