Example Code

Import and Export Powerpoint Slides To and From DIAdem

Code and Documents

Attachment

 This example illustrates how you can import custom layouts from Powerpoint (i.e. the master slide deck) and then also export your reports afterwards to Powerpoint slides also. The code primarily uses ActiveX to communicate with Powerpoint as would be done with VBS - charts are currently stored as embedded objects within powerpoint which I'd like to keep this way to simplify transferring reports between individual users of this data.

 

All of the code is commented and I welcome any comments on issues found, feature requests or suggested modifications to improve or include new features.

 

Installation Instructions:

- Place the files all in the same directory wherever you wish, rename ImageCreator.txt to ImageCreator.exe (it's a necessity noted in the comments based on Microsoft's clipboard functionality lacking transparency copying of images).

- Run Menu.vbs from DIAdem Script panel.

- Report panel will now have a new menu named "Powerpoint".

 

Use:

- The Configure button provides functionality to browse for a .pptx powerpoint slide deck which has the custom layout you wish to import.

- Select the layout and click Import

- Modify reports as you wish

- Select Export to Powerpoint and the powerpoint will be created for you - do not use powerpoint while DIAdem has the run arrow displayed in the taskbar (it can take a while to export graphs currently).

 

Known Issues:

- If powerpoint is open, the import/export process can import/export incorrect shapes or overlay these across slides.

- If a shape with the same name to be imported exists in another report sheet then it will throw an error

- Currently only able to export sheets which were created via importing a custom layout

- Error is thrown if powerpoint slide with "EXAMPLE.pptx" is still open, possibly from a previous export process.

 

Next Version:

- Importing/Exporting of Tables

- More efficient process of exporting graph data - will be very slow for large channels

- Match text alignment

- Export blank reports which were not from imported slides

- Store images in a directory so as to clean up file structure during import process

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors