python-pptx

Python pptx – part of text in cell with different color

Python pptx – part of text in cell with different color Question: I am using pptx module to generate slide with table. I am able to change font in each cell, but what I also need is change font of specific word in text. In example “Generating random sentence as example”. In this world “random” …

Total answers: 1

Shape numbers/indexes of each pptx slide within existing presentation

Shape numbers/indexes of each pptx slide within existing presentation Question: 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 existing …

Total answers: 2

python-pptx – How to individually hide/show data labels in graph

python-pptx – How to individually hide/show data labels in graph Question: I would like to be able to flexibly show or hide data labels in a stacked bar chart. I thought this would have been possible by accessing an individual datalabel as such: plot.series[0].points[1].data_label and then assigning its has_text_frame attribute to True or False, but …

Total answers: 2

run.font.italic and run.font.bold return None instead of True

run.font.italic and run.font.bold return None instead of True Question: I need to get all text that is italic and bold in paragraphs. I am manually turning text into italic and bold form but the code below returns none. Is it only an initiator or can we get the value out of it as well, how …

Total answers: 2

How can I get the dimensions of a picture placeholder to re-size an image when creating a presentation and inserting a picture using python-pptx?

How can I get the dimensions of a picture placeholder to re-size an image when creating a presentation and inserting a picture using python-pptx? Question: I’m trying to insert a picture that is re-sized to fit the dimensions of the picture placeholder from a template using python-pptx. I don’t believe the API has direct access …

Total answers: 2

python-pptx: Getting odd splits when extracting text from slides

python-pptx: Getting odd splits when extracting text from slides Question: I’m using the “Extract all text from slides in presentation” example at https://python-pptx.readthedocs.io/en/latest/user/quickstart.html to extract text from some PowerPoint slides. from pptx import Presentation prs = Presentation(path_to_presentation) # text_runs will be populated with a list of strings, # one for each text run in presentation …

Total answers: 2

How can dynamic page numbers be inserted into added slides?

How can dynamic page numbers be inserted into added slides? Question: When adding slides via a modified python-pptx, placeholders appear for the slide number on each slide. Instead of the actual slide number, however, the words “Slide Number” appears in that field. Other answers mention using a static text box, but we need the placeholder …

Total answers: 2

python-pptx: read font color

python-pptx: read font color Question: I want to read the font color from a given textbox. I can extract font name and bold but not color (or font name). Here’s my code: text_frame = shape.text_frame paragraph = text_frame.paragraphs[0] for run in paragraph.runs: font = run.font try: font_size = font.size.pt print(font_size) font_bold = font.bold print(font_bold) font_name …

Total answers: 3

Replacing particular text in all sides of a ppt using python-pptx

Replacing particular text in all sides of a ppt using python-pptx Question: I am new with python-pptx. But I am familiar with its basic working. I have searched a lot but I could not find a way to change a particular text by another text in all slides. That text may be in any text_frame …

Total answers: 2