Questions tagged [python-pptx]

python-pptx is a Python library for creating and updating PowerPoint (.pptx) files.

python-pptx is a Python library for creating and updating PowerPoint (.pptx) files.

Latest documentation

Available from pypi.

734 questions
5
votes
4 answers

Extracting images from presentation file

I am working on python-pptx package. For my code I need to extract all the images that are present inside the presentation file. Can anybody help me through this ? Thanks in advance for help. my code looks like this: import pptx prs =…
Auro
  • 105
  • 1
  • 7
5
votes
3 answers

How to extract text from a text shape within a Group Shape in powerpoint, using python-pptx.

My PowerPoint slide has a number of group shapes in which there are child text shapes. Earlier I was using this code, but it doesn't handle Group shapes. for eachfile in files: prs = Presentation(eachfile) textrun=[] for slide in prs.slides: …
sjm20066
  • 75
  • 2
  • 6
5
votes
1 answer

How to set slide number in generated slide using python-pptx

I am generating new slides using python pptx and I see no way to update the slide number. I have set the footer in master layout but when I try to read the shapes, I don't see that component over there. My code: from pptx import Presentation prs =…
wayfare
  • 1,802
  • 5
  • 20
  • 37
5
votes
1 answer

Python-pptx - Text parameters (font, size, position) on Autoshape

How can I set font, size of text for the shape ? One Object instead two seperate ones (shape and Text, how use run for the shape) Just do not get how to set the parameters on Textframe instance of the Autoshape-object. from pptx import…
otluk
  • 317
  • 1
  • 4
  • 16
5
votes
3 answers

Python PPTX read slide number (page number)

I'm doing a custom table of content for slides that is generated by Python-PPTX. For the slides, footer and slide numbers already set up, and I can already view it in resulting PPTX. I believe slide numbers already exist, just needed to be read. My…
idazuwaika
  • 2,749
  • 7
  • 38
  • 46
5
votes
1 answer

Save matplotlib graph in a ppt file using python-pptx without saving figure

Is there any way to plot the matplotlib graph in a powerpoint presentation using python-pptx without saving the graph as *.jpg or *.png ? Below is the naive way is to save the matplotlib figure as image file and then loading it to python-pptx but…
muazfaiz
  • 4,611
  • 14
  • 50
  • 88
5
votes
1 answer

python-pptx: insert picture into content placeholder

I'm using python-pptx 0.6.0 and I created a slide with content with caption. I want to insert picture into the content placeholder but there is no attribute such as add_picture or insert_picuture to use. How can I add picture into this content…
Rhinoo Rhino
  • 61
  • 2
  • 3
5
votes
3 answers

How to pass PIL image to Add_Picture in python-pptx

I'm trying to get the image from clipboard and I want to add that image in python-pptx . I don't want to save the image in the Disk. I have tried this: from pptx import Presentation from PIL import ImageGrab,Image from pptx.util import Inches im =…
Saranya
  • 69
  • 1
  • 3
4
votes
1 answer

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

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 or FY22/23. But the…
The Great
  • 7,215
  • 7
  • 40
  • 128
4
votes
2 answers

convert powerpoint to xml format for bunch of powerpoint files

I need to convert bunch of powerpoint files into xml format. I have to change the all fonts in about 100 powerpoint files, without opening the files. There are several shape types in each slide and each might have a different font. I used…
Afshin Oroojlooy
  • 1,326
  • 3
  • 21
  • 43
4
votes
2 answers

How to copy chart from excel and paste it as chart into powerpoint (not image) using python

I have an excel file which generates chart based on the data available, the chart name is thisChart. I want to copy thisChart from excel file to the ppt file. Now I know the 2 ways to do that ie VBA and python(using win32com.client). The problem…
Prashant Kumar
  • 501
  • 8
  • 26
4
votes
2 answers

How to reverse category order on clustered bar chart in PowerPoint using Python-pptx?

I'm trying to generate a clustered bar chart using Python-pptx. However the order of categories that appear on the chart is the opposite of that in data table. In PowerPoint, check on 'Categories in reverse order' in category axis options would…
JasJin
  • 43
  • 3
4
votes
1 answer

python-pptx / Updating an existing Powerpoint chart without its excel sheet replacement

I have a powerpoint presentation with charts I want to update from python. Right now I am using python-pptx library which is great but its chart.replace_data() the method is replacing the excel sheet with chart data in the chart. Unfortunately, some…
Agniy
  • 41
  • 3
4
votes
2 answers

Inserting and formatting text in existing placeholder

I have a slide template that has a text placeholder. How do I insert and format text in that specific text placeholder ? text_ph1 = slide1.placeholders[14] text_ph2 = slide1.placeholders[15] para1 = ['Text for para 1'] para2 = ['Text for para…
Pawan_Malviya
  • 53
  • 1
  • 4
4
votes
1 answer

Print Power Point Slide number Using Python

I am trying to print the slide number and store it in a list in python, from a power point presentation using some specific String. Suppose I have a string named "CR". If CR is present in a slide then it will print that slide number and also store…
Shaon
  • 133
  • 1
  • 13
1 2
3
48 49