I am trying to print out a double
to excel. In my GUI the number prints out correctly.
But when I write the number to an excel file the number comes out with out the zeros after the decimal place. For examples the number 1.10
prints out correctly in my GUI, but in excel in prints out 1.1
.
double foo = 1.10;
writeline(foo.ToString("F2"));
I have tried String.Format("{0:0.00}", foo.ToString("F2"));
without resolving this issue. I am pretty sure the problem is when the number gets into excel, excel truncates all zeros after the decimal place. Is there a way to send excel a message to print out two places after the decimal?
I am working on someone elses code that opens and closes the excel file. They are using File.Create
and StreamWriter
to create and open the excel file