Issue #632 wontfix
Zac Miller created an issue

UNDERLINE.JPG

I'm not sure if this is a bug or if I'm just doing something wrong. I have a sheet with underlined values that I'm trying to access. Whenever I work with the cell the underlining isn't present in the font/style and just returns None. I have other cells that have italics and I can find them fine. Am I doing something incorrectly on my end or is the code not working as intended?

In[45]: ws['A252']
Out[45]: <Cell Database.A252>
In[46]: ws['A252'].value
Out[46]: u'Amundsen-Ganswindt'
In[47]: ws['A252'].font
Out[47]: Font(name='Arial', b=True, color=Color(indexed=Values must be of type <type 'long'>, auto=Values must be of type <type 'bool'>, theme=Values must be of type <type 'long'>), sz=10.0)
In[48]: ws['A252'].font.underline

I tried this on 2.3.2 and 2.4.0-a1.

Comments (5)

  1. CharlieC

    Looks like an old file. The default for underlining is single if no value is set but the element is there.

    <xsd:complexType name="CT_UnderlineProperty">
        <xsd:attribute name="val" type="ST_UnderlineValues" use="optional" default="single"/>
    </xsd:complexType>
    
  2. Zac Miller reporter

    I'm assuming that you mean the xlsx file is old. I created the xlsx file I have by opening an old xls file and saving it as an xlsx in Excel. Based on what you said I created a new xlsx file in a recent version of Excel and added two cells (one underlined and the other not). I got the same result of getting None when checking for the underlining.

  3. CharlieC

    The problem is that Excel treats <u/> the same as <u val="single"> and not <u val="none"/>. It's almost impossible to map this to a sensible Python API so we don't.

  4. Log in to comment