0

I am using Excel Library - http://code.google.com/p/excellibrary/ - To generate an excel 2003 spreadsheet. Everything works fine except when some big values are used.

These are some reference numbers that are used by a client and I simply need to present them as integer values in the spreadsheet.

int val = 1420007117;
worksheet.Celss[row, col] = new Cell(val); // Displays - 352108063

This results in the value 352108063 being displayed in the spreadsheet. If the value is lower, then it displays fine.

Anyone know what the issue might be, or how to work around this problem. Outputting the value as string is not possible as it leaves a green Number stored as Text error.

Kami
  • 19,134
  • 4
  • 51
  • 63
  • Use Long rather than Integer – Gary's Student Oct 14 '13 at 12:57
  • 1
    I would say that [tag:Excel] doesn't support 64-bit integers and [tag:ExcelLibrary] doesn't care about it. For such big numbers you better use floating point. This is how Excel handles big numbers. – LS_ᴅᴇᴠ Oct 14 '13 at 13:15
  • @LS_dev Thanks, I used double with formatting to achieve the result. Post your comment as answer and I will accept it. Long(Int64) did not work. – Kami Oct 14 '13 at 13:41

1 Answers1

1

I would say that doesn't support 64-bit integers and doesn't care about it.

For such big numbers you better use floating point. This is how Excel handles big numbers.

LS_ᴅᴇᴠ
  • 10,823
  • 1
  • 23
  • 46
  • Looking at the source code for Excel Library; it appears to binary shift the value to written and as a possible result cause this issue, however, double values are written as normal. AS such, using double has worked. – Kami Oct 14 '13 at 14:01