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
3
votes
1 answer

Django the powerpoint generated using python-pptx library has error message

I use python-pptx v0.6.2 to generate powerpoint. I read a exist powerpoint into BytesIO, then do some modification and save it. I can download the file successfully, and I'm sure the content can be write into the file. But when I open the…
Leon Chen
  • 53
  • 1
  • 8
3
votes
1 answer

python pptx - check if object is a table, textbox or image

I use python 2.7 with python pptx, I need to build a general function to center objects in my slide. I know how to center any individual object type (textbox, table, image etc.) and need to build a function to tell which type of object is a given…
thebeancounter
  • 4,261
  • 8
  • 61
  • 109
3
votes
2 answers

Adding a bottom line to each row in a table in a PPTX generated by Python

I have a table which is generated by, and placed in a PPT file, using the pptx module python-pptx. I want to add a line between each row of the table in my PPT file. My current code: prs = Presentation('existing-presentation.pptx') slide =…
user425727
2
votes
0 answers

.add_picture in python-pptx changes the description of the image from the given one to image.png

Use-case: I make a presentation in python-pptx and then manually go in and add some slide and then remember that I need to change one or more of the pictures. Then I want to be able to run the program again and have it replace the picture with the…
Selfors
  • 41
  • 3
2
votes
0 answers

How to fit shape to text with python-pptx

I am creating a textbox on a PowerPoint slide with the python-pptx package. I am using what I think is the correct auto-size attribute at the end of the below code but the textbox does not expand to fit the text. Any suggestions on what I am doing…
jim_jones
  • 167
  • 3
  • 13
2
votes
1 answer

How to modify existing tables in powerpoint using pandas and python-pptx?

I have a table similar to this that I would like to modify: I'm still new to this library and I can't seem to understand how to modify existing tables from the documentation. What's the best way to do it? I already have the dataframe (3 columns, 8…
Zaid H
  • 63
  • 5
2
votes
1 answer

python-pptx: Any way to make text vertical?

Is there any way to control text direction in python-pptx? What I want to do is make text in shapes vertical as shown in the image below. I have searched the documentation for hints but found nothing. One simple solution seems to be to make a…
all_aest
  • 33
  • 4
2
votes
1 answer

python-pptx: replacing one picture image with another

I've just stumbled across this, it looks extremely useful. I found some examples for manipulating slides and the like, my particular use case involves basically replacing a bunch of images within a given presentation with different image files, but…
ljwobker
  • 832
  • 2
  • 10
  • 20
2
votes
1 answer

Is there a way to use pptx-python with python verion 3.7 and make exe with pyinstaller?

ppt.py: from pptx import Presentation newPPT = Presentation() newPPT.save("MyPPT.pptx") converting to exe: cmd == pyinstaller --onefile ppt.py once ready, the error is: exception pptx.exc.PackageNotFoundError Raised when a package cannot be found…
Med
  • 177
  • 1
  • 1
  • 8
2
votes
2 answers

text alignment in title placeholder with python pptx

I'm new in work with python pptx and I need to alignment the title text. I was written this code bellow code: from PIL import Image from pptx import Presentation from pptx.chart.data import CategoryChartData from pptx.enum.chart import…
2
votes
2 answers

How to make long text fit into a text_frame? Python-pptx

I'm working with python-ppt to create a portfolio of candidates in a Powerpoint presentation. There is one candidate per slide and each of them has provided information about themselves like name, contacts and a minibio (the problem I'm here to…
2
votes
1 answer

How to update the date range on X-Axis with python-pptx

I have a multi-line chart that I'm trying to update the data for. I can change the data for the data series (1 to 5) in my case using a dataframe; I'm unable to figure out how to change the range for the category axis. In the current scenario, I…
Rajat
  • 111
  • 13
2
votes
0 answers

python pptx table cell fill and border colors

Good day, Python-pptx allows me to fill table cell with a color, or allows to have that cell's borders with parametrized width and color. However I can not do both, since after the fill borders disappear. I wonder how to properly combine these…
Dan_Banan
  • 21
  • 5
2
votes
1 answer

AttributeError: 'SlidePlaceholder' object has no attribute 'insert_picture'

Any help to debug? I just want to load images from a folder, put them in the placeholders and save the pptx under a new name. I am getting this error from my code: AttributeError: 'SlidePlaceholder' object has no attribute 'insert_picture' import…
abandoh
  • 23
  • 1
  • 3
2
votes
2 answers

Is there a way to delete a shape with python-pptx

@scanny I have looked through python-pptx documentation and failed to find any method to delete a shape. The use case I am looking at is changing the shape present in the presentation based off secondary conditions. Is there any way to easily do…
Cole Spencer
  • 21
  • 1
  • 4