Well, I am afraid, this is the limitation put forth by MS Excel, so if you have (so called) numeric data in strings, it will not be formatted, you may confirm it in MS Excel manually. Therefore, you need to have pure numeric data to be formatted properly. You can check if your source data columns are numeric or strings, so you may change their type accordingly. Alternatively, you have to convert the data manually after the data is inserted/exported to the Excel worksheet and before applying any formatting.
The error "Numbers stored as text" will be always popped up in the Cells, if the numeric data is inserted as string/text.
By the way, you may iterate though all those cells in the column and use:
cell.PutValue(cell.StringValue, true) to make sure that the data should be converted properly to numeric formats to avoid this annoying pop up.
e.g.., You may change/extend the code accordingly.
Cells cells = worksheet.Cells;
//Format the column B to numeric column.
for (int i = 1; i < cells.MaxDataRowInColumn(1); i++)
cells[i, 1].PutValue(cells[i, 1].StringValue, true);
Dim cells As Cells = worksheet.Cells
'Format the column B to numeric column.
For i As Integer = 1 To cells.MaxDataRowInColumn(1) - 1
cells(i, 1).PutValue(cells(i, 1).StringValue, True)
Also, if you use: Cells.ImportDataTable() method to import data from the source data table on the back end, if this is the case, then you may use:
(Note: Put true for "convertStringToNumber" last parameter)