How to format Numbers in Excel programmatically in C #

3

I'm setting up a C # Requests report, I'm using the Microsoft.Interop.Excel library and I'm facing a problem:

It is necessary to include the Order number in this report and when it is presented in Excel it comes in Exponential Format: 7,80005E+12 , the original being: 78000496698755 .

I read on the Web that putting an Apostroph before the text would come correct, the problem is that this number is necessary for other conversions inside and outside the program file and this apostroph is barring some of these conversions.

My question is: Is there any kind of formatting that I can put for the content to come correctly, I tried the code below, but to no avail:

NumberFormat = "@";
    
asked by anonymous 12.04.2016 / 17:52

1 answer

4

I did not understand the question completely but try:

NumberFormat = "0";

Using this code is formatted the cell as numbers, in my example I was formatting as general text (where I fall into the problem of Exponentiation).

    
12.04.2016 / 18:22