How to know the active presentation's size? RRS feed

  • Question

  • Is it possible to know the active presentation's size on the fly? I mean, we don't have to save as, and check on the file's size.

    I tried to search for a similar property of the PowerPoint._Application.ActivePresentation, but cannot find out.

    Any recommendation?


    Note: I am using PowerPoint 2013, C#, VS Ultimate 2013

    Tuesday, June 30, 2015 9:52 AM

All replies

  • No, you need to save the presentation first.
    • Marked as answer by L.Hl Tuesday, July 7, 2015 10:22 AM
    • Unmarked as answer by chipbk11 Tuesday, August 18, 2015 12:45 PM
    Tuesday, June 30, 2015 2:37 PM
  • I found out a way to know the presentation's size on the fly by using BuiltInDocumentProperties method.

    • object GetPowerPointPresentationPropertyValue(PowerPoint.Presentation presentation, string propertyName)
    • {
    •   object builtInProperties = presentation.BuiltInDocumentProperties;
    •   Type builtInPropertiesType = builtInProperties.GetType();
    •   object property = builtInPropertiesType.InvokeMember("Item", BindingFlags.GetProperty, null, builtInProperties, new object[] { propertyName });
    •   Type propertyType = property.GetType();
    •   object propertyValue = propertyType.InvokeMember("Value", BindingFlags.GetProperty, null, property, new object[] { });
    •   return propertyValue;
    • }

    The builtInDocumentProperties contains many useful infos, including the size of the presentation. 

    - For example, if you want to get the author's name, you call: 

    object o = GetPowerPointPresentationPropertyValue(Pres, "Author");

    - If you want to get the number of slides, you call:

    object o = GetPowerPointPresentationPropertyValue(Pres, "Number of slides");

    However, I cannot get the size via "number of bytes":

    object o = GetPowerPointPresentationPropertyValue(Pres, "Number of bytes");

    Is there anyway to list all properties of the builtInDocumentProperties?


    Note: reference links: link1link2

    Tuesday, August 18, 2015 12:28 PM