Cannot create print titles with workbook.create_print_titles

Issue #417 resolved
Josh Haywood
created an issue

The named range is created properly but it doesn't properly become the named range for the print titles. The problem seems to be that the scope of the print titles named range is incorrect (at least, if I am understanding it correctly). Instead of the scope being the worksheet name as it is if I create print titles manually in Excel, the scope is always 'Workbook', which seems to be the default. Here's a relevant snippet of the code I'm using:

wb = Workbook()
ws = wb.active
ws.add_print_title(1, rows_or_cols='rows')

The two files included show what the issue is. The file generated using openpyxl creates the same named range as the file created using excel menus, the only difference is the scope of the named ranges.

I've tried a couple ways of passing the worksheet name to scope in workbook.create_named_range, and tried creating a named range directly using create_named_range with the name '_xlnm.Print_Titles' to no avail. If I come up with something, I'll update here and submit a pull request.

Comments (5)

  1. Log in to comment