Rahul Agarwal
Rahul Agarwal

Reputation: 4100

Merging of cell not working in Python PPTx

My Code:

path =r"Sample PPT.pptx"

prs = Presentation(path)
title_slide_layout = prs.slide_layouts[3]
slide = prs.slides.add_slide(title_slide_layout)
title = slide.shapes.title
title.text = "Summary Table"
shapes = slide.shapes

""" Putting the table in placeholder"""

placeholder = slide.placeholders[13]
graphic_frame = placeholder.insert_table(rows=df.shape[0]+2, cols=df.shape[1])
table = graphic_frame.table

"""Merging cells and naming them """
start_cell = table.cell(0, 0)
end_cell = table.cell(1,1)
start_cell.merge(end_cell)

Error:

AttributeError: '_Cell' object has no attribute 'merge'

Python - 3.5.x

Any help on why this error!!

Upvotes: 1

Views: 745

Answers (1)

scanny
scanny

Reputation: 28903

This functionality was added relatively recently (v0.6.14, 2018-09-24).

Check your python-pptx version, I expect you need a pip install -U python-pptx :)

Upvotes: 2

Related Questions