Monday 6 August 2012

Prob. in exporting Excel Large Number

Yes, Suppose
This is your GridView:
beforeexport
And now you want to export it to Excel So Your Transaction Id will be messed.
Exported Display of Excel:
after export
Cause & Resolution:
http://forums.asp.net/t/1815096.aspx/1?export+to+excel+problem



Excel isn't really messing up the field. Two things are happening:
  1. Excel formats large numbers in scientific notation. So "100101100000001" becomes "1.00101E+14".
  2. The size of the number "100101100000001" exceeds the precision in which Excel uses to store values. Excel stores your number as "100101100000001" so you're losing the last five digits.
Depending on your needs you can do one of two things.
  • Your first option is to change the formatting from "General" to "0" (Number with zero decimal places.) This will give you "100101100000001" so you will have lost precision but you will be able to perform calculcations on the number.
  • The second option is to format the cell as text "@" or to paste your field with an apostrophe at the beginning of the line to force the value to be text. You'll get all of the digits but you won't be able to do calculations of the value.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More