This project is read-only.
1

Resolved

Spreadsheetwriter fails with decimal datatype

description

The method ToXmlNumeric test for decimal returns a double instead of a decimal.
 
If you correct the method like this, it works:
    public static string ToXmlNumeric(object value)
    {
        if (value.GetType() == typeof(short)) return XmlConvert.ToString((short) value);
        if (value.GetType() == typeof(int)) return XmlConvert.ToString((int) value);
        if (value.GetType() == typeof(long)) return XmlConvert.ToString((long) value);
        if (value.GetType() == typeof(float)) return XmlConvert.ToString((float) value);
        if (value.GetType() == typeof(double)) return XmlConvert.ToString((double) value);
        if (value.GetType() == typeof(decimal)) return XmlConvert.ToString((decimal) value);
        if (value.GetType() == typeof(ushort)) return XmlConvert.ToString((ushort) value);
        if (value.GetType() == typeof(uint)) return XmlConvert.ToString((uint) value);
        if (value.GetType() == typeof(ulong)) return XmlConvert.ToString((ulong) value);
 
        return value.ToString();
    }
}

comments

JamesWestgate wrote Jan 26, 2010 at 9:46 PM

This has been fixed. Thank you for the feedback.

wrote Feb 22, 2013 at 12:11 AM

wrote May 16, 2013 at 11:43 AM

wrote May 16, 2013 at 11:43 AM

wrote Jun 14, 2013 at 8:25 AM