Unplanned
Last Updated: 09 Jan 2026 05:47 by Eric Moreau
Eric Moreau
Created on: 09 Jan 2026 05:47
Category: SpreadProcessing
Type: Feature Request
1
SpreadProcessing: Add support for preserving decimal data columns as numeric when importing with DataTableFormatProvider

Currently, if you have a decimal column in the DataTable, it is imported as a text column in the workbook. It should be preserved as a numeric column after importing.

Note: When importing a DataTable, each of the column's type is checked and a respective cell type is imported. 

 if (dataType.IsValueType && dataType.IsPrimitive && !dataType.IsEnum)
                    {
                        newValue = new NumberCellValue(Convert.ToDouble(value));
                    }
The check ensures only “simple” CLR value types are treated as numbers when importing from DataTable to the worksheet.

IsValueType: filters out reference types.

IsPrimitive: narrows to CLR primitives (sbyte, byte, short, ushort, int, uint, long, ulong, float, double, char, IntPtr, UIntPtr, bool).

!IsEnum: excludes enums.

In this code path, primitives are interpreted as numeric and converted to a Double for NumberCellValue. This avoids trying to numeric-convert arbitrary structs (e.g., guid, TimeSpan, custom structs), which should not be treated as numbers.

Decimal is not primitive, so it falls back to text, losing numeric semantics. This is the reason for the observed behavior.
0 comments