PP_ALIGN.CENTER do nothing

Question:

The below line code do nothing:

row.cells[0].text_frame.paragraphs[0].alignement = PP_ALIGN.CENTER

It also does not throw any error.

Am I doing something wrong there ?

Below is the reproducible example :

for row_idx, row in enumerate(table.rows):
    row.cells[0].text_frame.paragraphs[0].alignement = PP_ALIGN.CENTER

The goal of the above code is to center first cell of each row. But for now they keep being aligned on the left.

Asked By: TourEiffel

||

Answers:

It’s highly likely to be alignment, not alignement.

The latter is an attribute with no usefulness.

I have got table cell alignment to work in my md2pptx (https://github.com/MartinPacker/md2pptx)package. (And, no, this is not intended to be an advert for that. Feel free to browse the code.)

Answered By: Martin Packer
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.