0

I was wondering if someone could help - complete Newbie in Python and struggling. I have a Pandas, Dataframe which I have then exported to a table in word using Docx however I am struggling to set the font size to 7. and to draw the lines around the table can anyone help please?

My code to create the table from the data frame ive created is as follows:

t = doc.add_table(newdataframe.shape[0]+1, newdataframe.shape[1]) for j in range(newdataframe.shape[-1]):
    t.cell(0,j).text = newdataframe.columns[j]

for i in range(newdataframe.shape[0]):
    for j in range(newdataframe.shape[-1]):
        t.cell(i+1,j).text = str(newdataframe.values[i,j])

Would be extremely grateful for anyones help :)

Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
  • Possible duplicate: https://stackoverflow.com/questions/43007725/python-docx-how-to-change-table-font-size. Check if the answers there help you solve your issue. – Asaf Amnony Sep 17 '20 at 14:43
  • Thanks - @AsafAmnony tried the link you suggested still couldn’t get it working ah well they can manually change in word!! – Chris Barton Sep 18 '20 at 07:13

0 Answers0