New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set string type attribute correctly for formula values #122

Closed
jkyeung opened this Issue May 21, 2014 · 2 comments

Comments

2 participants
@jkyeung
Contributor

jkyeung commented May 21, 2014

When attempting to write both a formula and a value to the same cell, the value is currently "type-checked" using float() (see Worksheet._write_cell). So strings that happen to look like numbers get treated as numbers, just like what used to happen for cells that don't contain formulas.

I believe the proper fix is to determine str_types (like what was done for Worksheet.write) and then do

if isinstance(cell.value, str_types):
    attributes.append(('t', 'str'))

I don't know the best way to set and access str_types for speed. One naive guess would be to assign it at the module level, like for the various "cell_blah_tuple" named tuples.

@jmcnamara jmcnamara self-assigned this May 21, 2014

@jmcnamara jmcnamara added the bug label May 21, 2014

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara May 21, 2014

Owner

@jkyeung, Thanks for that. I'll put in a fix for it.

Owner

jmcnamara commented May 21, 2014

@jkyeung, Thanks for that. I'll put in a fix for it.

@jmcnamara

This comment has been minimized.

Show comment
Hide comment
@jmcnamara

jmcnamara Jul 22, 2014

Owner

Fixed in version 0.5.6. Thanks.

John

Owner

jmcnamara commented Jul 22, 2014

Fixed in version 0.5.6. Thanks.

John

@jmcnamara jmcnamara closed this Jul 22, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment