none
Exporting shapes in PowerPoint 2013 RRS feed

  • Question

  • Hi

    I am in the process of developing a C# PowerPoint 2013 addin via VSTO that allows to export parts of a presentation as LaTeX source to be used in beamer presentations. A crucial point to do this in a reasonable way is the ability to export power point shapes representing graphics objects to image files that can also be included in LaTeX.

    I know that in previous versions of the PowerPoint Interop API, there existed a method Shape.Export which allowed to do exactly this. However, while in previous versions of the API this was marked with "for internal use only", the method is gone in the PowerPoint 2013 API. The same seems to be true for the Export method of the ShapeRange object.

    So my question is: What is now the correct way to export image objects via the API in PowerPoint 2013? Is there any workaround for the missing method? Also, why has it been removed? I think it is quite crucial to do numerous interesting things I can think of ...

    Thanks,

    is

    Friday, December 6, 2013 7:10 PM

Answers

  • Hello,

    As you may see the Shape doesn't provide the Export method any longer (it was marked as deprecated in PP 2010 - Reserved for internal use.). As a workaround you can use the Export method of the Slide, Presentation, SlideRange and Chart classes from the PowerPoint Object Model.  

    Note, PowerPoint presentations (*.pptx) are really just compressed directories with files. This is true for PowerPoint 2007,2010 and 2013 (where the *.pptx file format is used by default).

    You need to follow the listed below steps for extracting images from the presentation:

    1. Click the presentation that you want, then right-click it and choose Rename.
    2. Change the file extension (*.pptx) to *.zip. Press ENTER to set the name, then click Yes in the Rename dialog box.
    3. Double-click the zipped file to open an Explorer window for the content files. The zipped file contains several folders, many of which contain information such as XML code or properties. Objects such as videos, sounds or other files can be found in the ppt folder.

    To restore the original presentation you need to repeat this procedure, changing the file extension from *.zip to *.pptx.

    All these steps can be done programmatically using classes from the System.IO namespace. Also you can use the Open XML SDK for decreasing the amount of code required for managing the *.pptx file content. MSDN provides a lot of HOWTOs for learning the basics.

     

    • Marked as answer by ing_sch Wednesday, December 11, 2013 10:35 PM
    Saturday, December 7, 2013 11:18 AM