Strings that start with zero ReadSheetRow bug

Feb 27, 2013 at 4:15 PM
In the following code I don't understand why you try to parse the value as a double then assign object o this parsed value. The code after this parsing you handle strings but at this point you've converted it to a double. So in Excel I have a string of 02272013 will come out as 2272013.

I would think the double.parse should happen after any string handling.
double number;
                        object o = _xmlReader.Value;

                        var style = NumberStyles.Any;
                        var culture = CultureInfo.InvariantCulture;
                        if (double.TryParse(o.ToString(), style, culture, out number))
                            o = number;

                        if (null != a_t && a_t == XlsxWorksheet.A_s) //if string
                        {
                            o = Helpers.ConvertEscapeChars(_workbook.SST[int.Parse(o.ToString())]);
                        }
                        if (null != a_t && a_t == XlsxWorksheet.N_inlineStr) //if string inline
                        {
                            o = Helpers.ConvertEscapeChars(o.ToString());
                        }
Developer
Feb 27, 2013 at 4:20 PM
I don't think I understand either, it sounds like an issue. The original authors of that code have moved on so we can't ask them (unless that is a new commit).

I can copy this to a work item if you are able to submit an Excel document and a small function that shows the issue.