Search code examples
pythonpython-3.xpython-docx

How to use the 'Total Row' style option in Word using Python docx


I am using python along with python-docx with pandas to copy a dataframe into Microsoft Word.

I have successfully managed to copy the data over into a table and apply a style contained within the Word file, but what I cannot figure out is how to apply the Total Row style option to the final row in the table so that it applies the styles used for totals rows (see screenshot from Word below).

I have tried looking through table styles and latent styles contained in python-docx but can't identify any way of picking the Total Row option.

Any help would be greatly appreciated!

enter image description here


Solution

  • I have since found out that the current version of the module doesn't support modifying these style options. I have requested the functionality be added in a future version.