Click here to Skip to main content
15,913,361 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi ,

is it possible to allow more than 15 digits in a Cell of MS Excel or CSV format

while i exporting data from grid to a excel ,the 16th position of the number is coming as 0.

i,e if the number is 2312345678445008 in grid cell and after exporting into excel this value is showing in excel as 2312345678445000.

Here my Code,

C#
Response.ClearContent();
               Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", "Customers.csv"));
               Response.ContentType = "application/text";
               //GridView1.AllowPaging = false;
               //GridView1.DataBind();
               StringBuilder strbldr = new StringBuilder();
               for (int i = 0; i < GridView1.Columns.Count; i++)
               {
                   //separting header columns text with comma operator
                   strbldr.Append(GridView1.Columns[i].HeaderText + ',');
               }
               //appending new line for gridview header row
               strbldr.Append("\n");
               for (int j = 0; j < GridView1.Rows.Count; j++)
               {
                   for (int k = 0; k < GridView1.Columns.Count; k++)
                   {
                       //separating gridview columns with comma
                       strbldr.Append(GridView1.Rows[j].Cells[k].Text + ',');
                   }
                   //appending new line for gridview rows
                   strbldr.Append("\n");
               }
               Response.Write(strbldr.ToString());
               Response.End();


How can i rectify this issue.
Posted
Updated 8-Apr-14 20:32pm
v3

1 solution

No: http://en.wikipedia.org/wiki/Numeric_precision_in_Microsoft_Excel[^]
Excel works to a maximum of 15 digit precision, regardless of the input format.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900