Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible incomplete hidden columns detection #41

Open
Pymancer opened this issue Jun 4, 2020 · 0 comments
Open

Possible incomplete hidden columns detection #41

Pymancer opened this issue Jun 4, 2020 · 0 comments

Comments

@Pymancer
Copy link

Pymancer commented Jun 4, 2020

If we have multiple hidden columns in a row only first column letter will be stored in column_dimensions by openpyxl, and pyexcel checks the hidden column state by it's letter, thus skipping the subsequent columns:

if self._native_sheet.column_dimensions[letter].hidden is False:

Shouldn't they also be checked for hidden state with something like:

    def is_column_hidden(self, column_index):
        letter = openpyxl.utils.get_column_letter(column_index)
        for l, d in self._native_sheet.column_dimensions.items():
            if l > letter:
                break
            if d.hidden is True and (l == letter or (column_index >= d.min and column_index <= d.max)):
                return True

        return False

?
Then

if self._native_sheet.column_dimensions[letter].hidden is False:

can be replaced with

if not self.is_column_hidden(column_index):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant