ClosedXml四舍五入到小数的第16位,我正在寻找更高的算术精度(小数点后20位)

问题描述 投票:0回答:1

我正在使用ClosedXML来读取excel文件。但由于某种原因,封闭的xml将单元格值四舍五入,格式化为十六进制的数字。我获得的值的示例是0.0232080359530551而不是0.02320803595305504993。我看着this!文章并尝试过,但没有成功。

尝试了所有这些选择但没有成功。

string me = string.Empty;
me = row.Cell(i).ValueCached;
me = row.Cell(i).RichText.ToString();
me = row.Cell(i).Value.ToString();
double d = 0.00000000000000000000;
d = row.Cell(i).GetDouble();
row.Cell(i).TryGetValue<double>(out d);
var fme = row.Cell(i).GetValue<double>().ToString("N30");
var fmesd = row.Cell(i).GetValue<float>().ToString("N30");
var dddsdsd = Convert.ToDouble(row.Cell(i).GetType().GetField("_cellValue", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(row.Cell(i)));
var sdfljdlf = row.Cell(i).GetValue<string>();
c# excel closedxml
1个回答
1
投票

如果Excel中的数据类型为数字,则Excel已将其舍入为15位数。如果它是Text,那么你可以使用GetValue<string>()获得全长或使用GetValue<decimal>()获得数字。

© www.soinside.com 2019 - 2024. All rights reserved.