Search code examples
ms-wordpython-docx

Python-docx, can I write symbols inside table?


Can I write symbols inside a cell of a table using Python-docx? let's say σ (sigma). So far I got:

from docx import Document

document = Document()
table = document.add_table(rows=2, cols=2)
table.style = 'TableGrid' #single lines in all cells

heading_cells = table.rows[0].cells 
heading_cells[0].text = '\sigma'

document.save('test.docx')

Solution

  • Actually, it works with:

    heading_cells[0].text = 'σ'