title: How to change alignment of cell text in MS Word table without "paragraph" object
body: <p>I have a MS Word "template" file that I am opening, modifying with new data from various sources, and then saving as a new file. I have multiple tables in the template document which are appropriately styled, including centered text inside of table cells.</p>
  
  <p>Having some familiarity with the python-docx module, I am able to alter the table's data easily, by assigning new values to <code>cell.text</code>. However, whenever I assign <code>cell.text</code> a new value, the new data is no longer centered, but is instead left-justified.  </p>
  
  <p>I have browsed several similar questions, but all of the answers seem to involve modifying paragraph objects. <a href="https://stackoverflow.com/questions/42736364/docx-center-text-in-table-cells">This</a> post was helpful and provided a quick POC, but also doesn't deal with <code>cells</code>, but instead adding <code>paragraphs</code> to tables. However, it was helpful seeing that <code>paragraph</code> objects have an <code>alignment</code> attribute.</p>
  
  <pre class="lang-py prettyprint-override"><code># Example table
  table = doc.add_table(rows=0, cols=2)
  row = table.add_row().cells
  
  p=row[0].add_paragraph('center justified text')
  p.alignment = WD_ALIGN_PARAGRAPH.CENTER
  
  p.alignment
  &gt;&gt;&gt; 1
  </code></pre>
  
  <p>For my current case, I noticed that <code>cells</code> do not have the <code>alignment</code> attribute. I then tried to modify the paragraph objects, but nothing changes.</p>
  
  <pre class="lang-py prettyprint-override"><code>from docx import Document
  from docx.enum.text import WD_ALIGN_PARAGRAPH
  doc = Document(BASE_DOC)
  
  # test table, row, and cell
  table = doc.tables[1]
  row = table.rows[4]
  cells = row.cells
  cells[0].alignment
  &gt;&gt;&gt; AttributeError: '_Cell' object has no attribute 'alignment'
  
  # attempt to modify paragraph alignment in table cells
  for col in table.columns:
      for cell in col.cells:
          for par in cell.paragraphs:
              par.alignment = WD_ALIGN_PARAGRAPH.CENTER
  
  doc.save(NEW_DOC)
  
  </code></pre>