允许在MSoffice或CSV格式的Excel单元格中输入超过15位数 [英] Allow to enter more than 15 digits in excel cell of MSoffice or CSV format

查看:339
本文介绍了允许在MSoffice或CSV格式的Excel单元格中输入超过15位数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





可以在MS Excel或CSV格式的单元格中允许超过15位数



当我将数据从网格导出到excel时,该数字的第16个位置将以 0 的形式出现。



i,如果网格单元格中的数字是 2312345678445008 ,则导出到excel后,此值将显示在excel中as 2312345678445000



这里是我的代码,



 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 ++)
{
// 使用逗号运算符分隔标题列文本
strbldr.Append(GridView1.Columns [i] .HeaderText + ' ,');
}
// 为gridview标题行追加新行
strbldr.Append( \ n);
for int j = 0 ; j < GridView1.Rows.Count; j ++)
{
for int k = 0 ; k < GridView1.Columns.Count; k ++)
{
// 将gridview列与逗号
strbldr.Append(GridView1.Rows [j] .Cells [k] .Text + ' );
}
// 为gridview行追加新行
strbldr .Append( \ n);
}
Response.Write(strbldr.ToString());
Response.End();





如何纠正这个问题。

解决方案

否: http://en.wikipedia.org/wiki/Numeric_precision_in_Microsoft_Excel [ ^ ]

无论输入如何,Excel的最高精确度为15位数格式。

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,

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.

解决方案

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.


这篇关于允许在MSoffice或CSV格式的Excel单元格中输入超过15位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆