title: Autofit column width with python pptx
body: <p>I have inserted a table into a pptx file and I want to auto adjust the column width so that none of the texts in the column cells needs to break line. So simply I am searching for an autoadjust of the whole column. </p>
  
  <p>What I have so far is:</p>
  
  <pre><code>from pptx import Presentation
  from pptx.util import Inches
  from PandasToPowerpoint import df_to_table
  import pandas as pd
  
  d = {'one' : pd.Series([1., 2., 3.], index=['a', 'b', 'c']),
       'two' : pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}
  df = pd.DataFrame(d)
  prs = Presentation()
  title_slide_layout = prs.slide_layouts[0]
  slide = prs.slides.add_slide(title_slide_layout)
  
  top = Inches(2.5)
  left = Inches(0.48)
  width = Inches(12.3)
  height = Inches(3.0) 
  df_to_table(slide, df.reset_index(), left, top, width, height)
  
  
  for shape in slide.shapes:
      if shape.has_table:
          table = shape.table
          for column in table.columns: 
              column.width=Inches(3)
  
  prs.save('test.pptx')   
  </code></pre>
  
  <p>I tried:</p>
  
  <pre><code>column.text_frame.auto_size = True
  column.auto_size = True
  column.fit_text= True
  </code></pre>
  
  <p>but they all do not work. If autoadjust is not working I could also iterate through all cells of a column and identify the one with the longest text and adjust the whole column width to this text. But I could also not find the right command to get the text width... Any idea is appreciated!</p>