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
0 answers

how to change cell borders and add table boder python pptx

I have a problem in changing the cell thickness of a table in PowerPoint Python this is my code : @staticmethod def SubElement(parent, tagname, **kwargs): element = OxmlElement(tagname) element.attrib.update(kwargs) …
mrrsh2000
  • 31
  • 4
3
votes
1 answer

How to paste an Excel chart into PowerPoint placeholder using Python?

I have an excel file with a series of formatted charts on a tab called Charts. I have named the charts, Figure1, Figure2, Figure3, etc. I have an existing PowerPoint template. The template has 2 placeholders per slide (so that it can accommodate 2…
brb
  • 1,123
  • 17
  • 40
3
votes
3 answers

Extract hyperlink from pptx

I want to extract the hyperlink from pptx, I know how to do it in word, but anyone knows how to extract it from pptx? For example, I have a text below in pptx and I want to get the url https://stackoverflow.com/ : Hello, stackoverflow I tried to…
Z.L
  • 147
  • 8
3
votes
1 answer

How to set font size of chart,axis values and axis titles in python-pptx for xyscatter chart

I have very simple xy chart that I made with python-pptx (thanks all from stack overflows who helped me with this). I am struggling with setting font size of XTitle, YTitle, ChartTitle, Series Name and also values on x any axis like (0 20 40 60).…
user2774120
  • 139
  • 3
  • 16
3
votes
3 answers

python pptx export img (png, jpeg)

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 =…
Alex Andre
  • 51
  • 1
  • 2
  • 7
3
votes
1 answer

How to do formatting changes in an table using pptx in python?

I have a dataframe that looks like this: c sp k1 k2 k3 k4 k5 k6 0 c1 70.73 0.3% 0.6% 0.7% 0.8% 0.7% 0.5% 1 c2 149.71 0.7% 0.6% 0.4% 0.6% 0.7% 1.0% 2 c3 -1.00 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 3 c4 …
quant
  • 4,062
  • 5
  • 29
  • 70
3
votes
2 answers

Preserve text format on read/write to shape text python pptx

I am looking to perform text replacements in a shape's text. I am using code similar to snippet below: # define key/value SRKeys, SRVals = ['x','y','z'], [1,2,3] # define text text = shape.text # iterate through values and perform subs for i in…
Michael Berk
  • 705
  • 7
  • 23
3
votes
1 answer

How to add hyperlink to an image in a ppt using python

Below is a piece of script which inserts a picture to the slide. I want to add hyperlink to the picture, but it doesn't work. from pptx import Presentation import pptx.util from pptx.util import Inches, Pt pptfile = r"C:\Users\prashant\NEW -…
Prashant Kumar
  • 501
  • 8
  • 26
3
votes
1 answer

Read chart data from existing chart using python-pptx

I'd like to use the python-pptx library to read data from charts inside a presentation. I've seen the documentation to replace chart data, but I can't figure out how to read data.
Varun Vembar
  • 318
  • 5
  • 18
3
votes
1 answer

Replacing data in a chart with known slide index and shape_id

I would like to update data in a Bar chart, but I am getting error at the step of accessing the object holding the chart. Here is code that gives me shape_id: shp=prs.slides[0].shapes for shape in shp: print( "id: %s, type: %s, name:…
Sveta
  • 161
  • 1
  • 2
  • 11
3
votes
2 answers

Shape numbers/indexes of each pptx slide within existing presentation

I am new to python pptx library and my question is: How can I define the list of shapes, the shape numbers/indexes (shapetree) and shape types of each pptx slide within an existing presentation using Python Library pptx? I would like to update an…
Sveta
  • 161
  • 1
  • 2
  • 11
3
votes
1 answer

How can I set the size of a slide using pptx-python?

I'm working with pptx-python and i want to set the default size of an slide to the panoramic size (16:9). By now i can only create slides with a size of 4:3, the default one. How can i change the size of a slide? I tried by accessing to width an…
cilopez
  • 75
  • 2
  • 9
3
votes
1 answer

Set theme with python-pptx

PowerPoint has themes you can chose from. The selction is like so: Is there a way to set the theme of a new presentation with python-pptx? Something like: from pptx import Presentation prs = Presentation() prs.set_theme(theme) ... On this github…
Jake P
  • 480
  • 3
  • 19
3
votes
0 answers

Has PPTX been updated to include secondary axes?

Someone else has asked this question, but it was from over a year ago and wanted to see if any updates had been made - does PPTX support putting a series of data on a secondary axis? Original question: Is it possible to set two value axis in…
KingT753
  • 81
  • 1
  • 5
3
votes
1 answer

Remove all metadata from powerpoint presentation using python-pptx

I am able to remove/overwrite some of the metadata (that which is stored in core.xml) with the following code: def remove_metadata(prs): """Overwrites the metadata in core.xml however does not overwrite metadata which is stored in app.xml""" …
Sam Redway
  • 7,605
  • 2
  • 27
  • 41