opened
mitchelljkotler
username_0
How can I set the column width for tables?  Right now, all columns in a table always have the same width.  I found https://github.com/python-openxml/python-docx/issues/78 from python-docx which looked promising, but this does not seem to work in python-pptx.

Thanks
Set column widths in tables
issue
created
mitchelljkotler
username_0
Nevermind - in python-pptx you can set the column widths directly, no need to set the cell widths (cells don't support setting their width)
comment
closed
mitchelljkotler
username_0
issue
created
anupreet-birr
username_1
@username_0 can you please share how to do it?
comment
created
MartinPacker
username_2
How about this? `shapeWidfth` is the width of the table shape.

```
cols = newTable.columns
        for colno in range(columns):
            cols[colno].width = int(shapeWidth * widths[colno] / widths_total)
```
comment
created
mitchelljkotler
username_0
@username_1 This was a long time ago!  Unfortunately, I no longer have access to the code as it was for a previous job, and I have not used python-pptx since then.  Hopefully @username_2's solution will help you.
comment