cell.style.font.strikethrough does not detect the strikethrough in cell

Issue #1110 invalid
Lau Meng Tee created an issue

My Spreadsheet cell A1 is normal text but cell A2 is a strikethrough font text cell. However, the openpyxl seems not able to pickup the strikethrough attribute:

Python 2.7.5 (default, Feb 18 2014, 14:56:58) [GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

from openpyxl import load_workbook

from openpyxl.styles import Font

wb = load_workbook(filename = 'junk.xlsx')


u'This is OK'




u'This is StrikeThrough'



Comments (8)

  1. CharlieC

    Thanks for the report. It's probably down to the way the elements are defined: OOXML allows <strike /> to be the same as <strike val="true" /> and not <strike val="false" /> and this requires special handling in openpyxl which tries to avoid such ambiguities.

  2. CharlieC

    Actually on checking the code for this I discovered that it's your code that's wrong. We haven't used the style attribute like this for several versions. Your code looks at the named style or style template that cell uses, in this case the default.

    from openpyxl import load_workbook
    wb = load_workbook("Issues/bug1110.xlsx")
    ws = wb.active
    c = ws['A2']
  3. Log in to comment