Hello
I'm just trying to fill up Excel file with numbers at runtime. Below is piece of code:
ExcelApp.Cells[iRow, iCol].NumberFormat = "F0"; //also "G" "F2" has been used
ExcelApp.Cells[iRow, iCol].Value = strNumber; //it's in European notation like 11,23 15334,67 189 and so on
If the number is whole it's OK, but when it has fraction it's being treated as text and can't be used to autosum. Why?
Sorry for no file, this forum does not allow to add attachment

VulpesRank #55 · 29.2K reputationPosted Jun 2, 2014, 12:23 PM EDT
ExcelApp.Cells[iRow, iCol].Value = strNumber.Replace(',', '.');
If it's no better, I'd try parsing the string to a double:
using System.Globalization;
// ...
CultureInfo ci = CultureInfo.GetCultureInfo("pl-PL");
ExcelApp.Cells[iRow, iCol].Value = Convert.ToDouble(strNumber, ci.NumberFormat);
kwestia35 reputationPosted Jun 2, 2014, 8:16 PM EDT
Still wrong, autosum works for whole numbers (they appears shifted right), if there's fraction they appears shifted left like text and can't be counted with autosum :(
All cells are in "custom format" #,#
Like in attachment .xls file