You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
#262
Open
codeyuha opened this issue
Aug 18, 2022
· 0 comments
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")
The text was updated successfully, but these errors were encountered: