This project has moved and is read-only. For the latest updates, please go here.

Why I am getting @ instead of expected numeric string value from a cell?

May 24, 2011 at 10:33 PM

I use ClosedXML to read data from an excel file. Specifically I use cell.GetString() to get a value from a cell. This seems to work fine for all cell types. At least it was until today. Today I got an excel file that in a cell with type Text contained a number 159. When I read the cell via ClosedXML I get back a value of ‘@’ (without the quotes, just an “at sign” symbol). I did some pocking around with the debugger and looking at the source XML file for the sheet and it appears that the cell is somehow corrupted. I say this because in the debugger I see that the cell object already has value ‘@’ , DataType is Text, and ShareString is set to true. But in the XML file for the cell I see that it is not presented as a string:

<c r="B2" s="27">

<v>159</v>

</c>

Some other cells that work properly have t=”s” attribute and do use shared values like:

<c r="B17" s="27" t="s">

<v>4939</v>

</c>

I tried using the apostrophe before the value and changing cell type to Generic but this did not help.

I do not really think that this is a problem with ClosedXML software itself but was wondering if someone by any chance had the same problem and found a workaround or perhaps the reason why a cell would get in a state like that.

Thanks in advance for your help,

Leo

May 24, 2011 at 10:54 PM

Thanks for the feedback. Please create a new entry on the Issue Tracker and attach the file so I can take a look...

May 26, 2011 at 9:46 AM

Thank you for the quick response. I opened a new Issue Tracker “Text cell with numeric value is returned as at sign (@)”, attached the file, and included the sample code.

Thanks again for looking into this,

Leo

May 27, 2011 at 12:05 AM

Update to version v0.53.1 5/25/2011 resolved this issue.

Leo