Hello, I followed the example from your documentation to hidden column and row in table - my docx file. How should one row or one column be hidden?
Opened this issue · 0 comments
YuriiHamii commented
from docx import Document
document = Document("to_hide.docx")
Table = document.tables[0]
par = Table.rows[0].cells[1].paragraphs[0]
hidden - only one cell
counter=0
for runs in par.runs:
counter += 1
runs.font.hidden = True # True False
print("Run", counter, " : ", runs.text)
hidden - column - 1
for col in Table.columns[1].cells:
style = document.styles['Normal']
col.font = style.font
col.font.hidden = True
hidden - row - 0
for cells in Table.rows[0].cells:
style = document.styles['Normal']
cells.font = style.font
cells.font.hidden = False
document.save("to_hide.docx")