python-pptx

Generate a Powerpoint slide for each image in a directory in Python?

Generate a Powerpoint slide for each image in a directory in Python? Question: I want to make a python script that imports all images in a file to each slide. I have about 30 images and I want it to auto generate a slide for each image. So far, I thought it would be easier …

Total answers: 1

Extracting Powerpoint background images using python-pptx

Extracting Powerpoint background images using python-pptx Question: I have several powerpoints that I need to shuffle through programmatically and extract images from. The images then need to be converted into OpenCV format for later processing/analysis. I have done this successfully for images in the pptx, using: for slide in presentation: for shape in slide.shapes if …

Total answers: 1

Python-pptx – How to insert a slide number for all slides

Python-pptx – How to insert a slide number for all slides Question: I am trying to automatically insert slide numbers to all my slides in PPT that is messy and strictly formatted. When we do manually,we are not able to do it for all the PPTs due to manual work involved. Is there anyway to …

Total answers: 1

PP_ALIGN.CENTER do nothing

PP_ALIGN.CENTER do nothing Question: The below line code do nothing: row.cells[0].text_frame.paragraphs[0].alignement = PP_ALIGN.CENTER It also does not throw any error. Am I doing something wrong there ? Below is the reproducible example : for row_idx, row in enumerate(table.rows): row.cells[0].text_frame.paragraphs[0].alignement = PP_ALIGN.CENTER The goal of the above code is to center first cell of each row. …

Total answers: 1

PPTX Python – How to fix ValueError: chart data contains no categories for a LineChart?

PPTX Python – How to fix ValueError: chart data contains no categories for a LineChart? Question: I’m trying to replace data in an existing line chart in Python PPTX. Here’s the code I’m using: for chart in charts: chart_data = CategoryChartData() chart_index = list(charts).index(chart) scenario_no = chart_index + 1 sc_df = wrk_df[wrk_df[‘Scenario No’] == scenario_no] …

Total answers: 1

python-pptx – How to replace keyword across multiple runs?

python-pptx – How to replace keyword across multiple runs? Question: I have two PPTs (File1.pptx and File2.pptx) in which I have the below 2 lines XX NOV 2021, Time: xx:xx – xx:xx hrs (90mins) FY21/22 / FY22/23 I wish to replace like below a) NOV 2021 as NOV 2022. b) FY21/22 / FY22/23 as FY21/22 …

Total answers: 1

python-pptx access table cell properties and apply it back during replace

python-pptx access table cell properties and apply it back during replace Question: I am trying to replace the table headers in powerpoint using python-pptx using the code below slides = [slide for slide in ip_ppt.slides] shapes = [] for slide in slides: for shape in slide.shapes: shapes.append(shape) def replace_text(replacements:dict,shapes:list): if shape.has_table: for row in shape.table.rows: …

Total answers: 2

download python-pptx from streamlit

download python-pptx from streamlit Question: I’m using python-pptx and streamlit. I’m creating a ppt from python like this: from pptx import Presentation import streamlit as st prs = Presentation() title_slide_layout = prs.slide_layouts[0] slide = prs.slides.add_slide(title_slide_layout) title = slide.shapes.title subtitle = slide.placeholders[1] title.text = "Hello, World!" subtitle.text = "python-pptx was here!" #prs.save(‘test.pptx’) # This works, just …

Total answers: 1

python pptx export img (png, jpeg)

python pptx export img (png, jpeg) Question: I have developed a small code in Python in order to generate PPTX. But I would like also to generate a picture in png or jpeg of this slide. from pptx import Presentation from pptx.util import Inches img_path = ‘monty-truth.png’ prs = Presentation() blank_slide_layout …

Total answers: 3

How to extract comments from PowerPoint presentation slides using Python

How to extract comments from PowerPoint presentation slides using Python Question: I need to extract comments (made using the Microsoft PowerPoint comment feature) from a series of PowerPoint presentations. The following link explains how to do it in C#: https://www.e-iceblue.com/Tutorials/Spire.Presentation/Spire.Presentation-Program-Guide/Comment-and-Note/Extract-comments-from-presentation-slides-and-save-in-txt-file.html It appears that python-pptx does not have the functionality to read/write comments from PowerPoint: https://python-pptx.readthedocs.io/en/latest/ …

Total answers: 3