Skip to content

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

Description

@codeyuha

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions