In Excel does not work the sum in the status bar for a file generated in C#. In the code I set the cell format as a number. Any idea what might be going on?
My code:
oWorksheet.Cells[vLinhaCelula, 7].NumberFormat = "0";
oWorksheet.Cells[vLinhaCelula, 7].Value = vValorNF.Replace(".", "");
oWorksheet.Cells[vLinhaCelula, 7].HorizontalAlignment = XlHAlign.xlHAlignRight;
Thanks for any help.
My guess is that vValorNF.Replace(".", ""); is returning a string, and therefore the cell becomes a string regardless of the number formatting. Try specifically creating a double or decimal
double num = Double.Parse(vValorNF.Replace(".", ""));
and then assigning
oWorksheet.Cells[vLinhaCelula, 7].Value = num;