I am trying to populate some values in a PPT Slide which has a table. These values are in a list and want to show them as bullet points. I am using python-pptx module for coding. How can I do this?
I tried the code below which creates a slide from an existing layout which has a Table placeholder.
# Insert and populate the Table in the slide.
def populate_table():
table_ph = slide.placeholders[12]
graphic_frame = table_ph.insert_table(rows = 2, cols = 3)
table = graphic_frame.table
# Get a handle to text_frame to a particular cell
tf = table.cell(1,2).text_frame
p = tf.paragraphs[0]
p.text = "Bullet 1"
p.level = 1
# Second Bullet value
p = tf.add_paragraph()
p.text = "Bullet 2"
p.level = 1
# Third Bullet value
p = tf.add_paragraph()
p.text = "Bullet 3"
p.level = 1
The Above code is printing/showing the 3 strings as 3 lines in the cell(1,2) but they are not appearing as bullet points.
Note: Running the same code in a text shape placeholder is displaying the bullet points.
shape = slide.placeholders[0] # This is a text placeholder.
tf = shape.text_frame
Can anyone please guide me what am i doing wrong? How can I show bullet points in a table cell?