Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • O openpyxl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 283
    • Issues 283
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 7
    • Merge requests 7
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • openpyxl
  • openpyxl
  • Issues
  • #1851
Closed
Open
Issue created Jul 11, 2022 by snippet@snippetDeveloper

Can't set `print_area` to None

Example:

from openpyxl import Workbook

wb = Workbook()
ws = wb.active

# Get the current print area, correctly returns None
print(ws.print_area)

# Print area is set correctly
ws.print_area = "A1:B10"
print(ws.print_area)

# Clear the print area
ws.print_area = None # Error here "'NoneType' object is not iterable"
print(ws.print_area)

Can't work out how to get a merge request in but you could fix this by changing line 892 of worksheet.py to:

        if value != None:
            self._print_area = [absolute_coordinate(v) for v in value]
        else:
            self._print_area = None

Test (Line 420 of test_worksheet.py)

    @pytest.mark.parametrize("cell_range, result",
                             [
                                 ("A1:F5",  ["$A$1:$F$5"]),
                                 (["$A$1:$F$5"],  ["$A$1:$F$5"],),
                                 (None, None),
                             ]
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking