Jump to content

Where is the Python-pptx library actually used? What is the final script and what should be the input parameters for the inital data function?


Mattia Sferrazza

Recommended Posts

Greetings,

Where is the Python-pptx actually used, as although it is mentioned that the library is required, it isn't imported in any of scripts provided. Furthermore, the Final Script in the first section, under "Automating visualization export and insertion into the PowerPoint document", seems to be missing the code line: "Document.Properties["visualization.path"]="C:{path to where the image is saved}\"+visual.Title+".png"", which was previously mentioned, yet isn't present in the Final script even though it isn't mentioned anywhere to remove it. Should this code line be included or not? Lastly, under the section "Create the data function", it says to add the following 4 parameters: Microsoft PowerPoint Template, Slide Layout ID, Picture Placeholder ID, Microsoft PowerPoint, yet in the image provided directly below, it showcases a fifth parameter: Visualization Image. Is this parameter necessary? I've followed the guide up until "Adding more than just a Visualization", yet it doesn't work for me, as the visualization gets downloaded to a folder I specify but isn't placed into the Powerpoint. I believe my issue may be caused by my misunderstanding of the three questions asked above.

Thanks,

Link to comment
Share on other sites

Hello Mattia,

Where is the Python-pptx actually used, as although it is mentioned that the library is required, it isn't imported in any of scripts provided.

The Python-pptx library is used in the Python data function. It is imported with the first line of the Python script (“from pptx import Presentation”).

Furthermore, the Final Script in the first section, under "Automating visualization export and insertion into the PowerPoint document", seems to be missing the code line: "Document.Properties["visualization.path"]="C:{path to where the image is saved}\"+visual.Title+".png"", which was previously mentioned, yet isn't present in the Final script even though it isn't mentioned anywhere to remove it. Should this code line be included or not?

Yes this code line should be added to the script. I updated the page accordingly.

Lastly, under the section "Create the data function", it says to add the following 4 parameters: Microsoft PowerPoint Template, Slide Layout ID, Picture Placeholder ID, Microsoft PowerPoint, yet in the image provided directly below, it showcases a fifth parameter: Visualization Image. Is this parameter necessary?

Yes this parameter is necessary as it points to the exported image. I updated the page accordingly.

I've followed the guide up until "Adding more than just a Visualization", yet it doesn't work for me, as the visualizations gets downloaded to a folder I specify but isn't placed into the Powerpoint. I believe my issue may be caused by my misunderstanding of the three questions asked above.

With the updates made to the article thanks to you, it should now work. The data function will be able to retrieve the exported image for inclusion into the PPTX document.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...