Reputation: 54541
There was a string (1008901023816550000000)
in the GridView somehow was saved as a scientific number (1.0089E+21)
in Excel when I exported the GridView to Excel.
I am using .Net 4.0.
Here is what I tried, but they didn't solve the problem:
DataFormatString="{0:g}"
to the BoundColumn
tag.style
after the RenderControl
was called. string style = @"<style> .text { mso-number-format:\@; } </script> ";
Can anyone shed some light on this problem?
Upvotes: 2
Views: 2871
Reputation: 1546
Try This, It will work.
string style = @"<style> TD { mso-number-format:\@; } </style> ";
Upvotes: 3
Reputation: 4657
Presuming you are using a CSV file to perform the export:
This is a quirk of Excel that's hard to shake. The only idea I know of is to try using a format like this inside the CSV file:
="1008901023816550000000"
This will force it to be a formula that returns the desired text.
Upvotes: 1