Unable to hide rows using row_dimensions

Anonymous avatarAnonymous created an issue

It is possible to hide columns using column_dimensions, e.g.

for c in range(4, 7):
    l = get_column_letter(c)
    ws.column_dimensions[l].visible = False

However trying to hide rows in the same way (using row_dimensions) doesn't work.

Comments (5)

  1. Anonymous

    I have the same problem (although I'm trying to hide rows instead of columns), and also tried setting the height to 0, but this had no effect. I'm also looking for a solution to this problem.

  2. Etienne Desautels

    Add theses lines:

        if not row_dimension.visible:
            attrs['hidden'] = '1'
    

    after line 159 in openpyx/writer/worksheet.py before the line:

        if row_dimension.height > 0:
    

    Maybe I will fork and do a pull request if I have the time.

  3. mozzbozz

    As far as I can see, the pull request has been accepted and therefore the issue should be resolved, shouldn't it? So if someone can mark this as as resolved, it would minimze the bug list a litte ;)

  4. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.