Reading headers not working

Issue #392 resolved
Holger Hoefling created an issue

I was trying to use openpyxl to read headers in some excel files I have. Despite seeing headers in Excel, the library does not return them. So I generated an example that also seems not to work. In the attached excel file, I inserted a left header. In the attached code I try to read it but always get the response "None"

from openpyxl import load_workbook

wb = load_workbook("HeaderNotWorkingExample.xlsx")
assert sheet.header_footer.hasHeader()

Comments (5)

  1. CharlieC

    @amorris I was just checking the history on this and it looks like you added the features in r508. Did you ever add dedicated tests for reading?

  2. CharlieC

    Wow, the formatting language for headers and footers is truly horrible. My initial guess that we don't support reading existing headers and footers is wrong and @amorris has done a great job trying to implement the specification: the various parts of a footer are lumped together with the formatting. The current code is being tripped up by a very simple bit of code &Ltest header. It looks like &L&test header is expected.

  3. Log in to comment