Skip to content

Instantly share code, notes, and snippets.

@jevo
Created December 15, 2015 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jevo/d30855ed97e25eeaf3bf to your computer and use it in GitHub Desktop.
Save jevo/d30855ed97e25eeaf3bf to your computer and use it in GitHub Desktop.
VSTO PowerPoint 2013 load BuildInDocumentProperties
/**
* this is only a snippet and it will cause errors during the compiling
* For more information see
* https://msdn.microsoft.com/en-us/library/microsoft.office.core.documentproperty.aspx
/
// put this into using area
using Office = Microsoft.Office.Core;
// the following code has to be add into a function
# region get/set property value for subject
Presentation pres = Globals.PowerPointInterpreterAddIn.Application.ActivePresentation;
Office.DocumentProperties properties = (Office.DocumentProperties)pres.BuiltInDocumentProperties; //get all properties
Office.DocumentProperty prop = properties["Subject"]; // get subject of presentation
// if properties is empty add subject text
if (prop.Value == null || prop.Value.ToString() == String.Empty)
{
// set the value of the property
prop.Value = getSubject(); //ToDo implement function getSubject()
}
// save presentation is necessary to keep the set subject
pres.Save
# endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment