Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何使用NPOI读取数字单元格的未格式化内容?_C#_Excel 2007_Npoi - Fatal编程技术网

C# 如何使用NPOI读取数字单元格的未格式化内容?

C# 如何使用NPOI读取数字单元格的未格式化内容?,c#,excel-2007,npoi,C#,Excel 2007,Npoi,我想读取数字单元格的未格式化内容(例如,0.05而不是5%和123456而不是123456.000) 我认为最简单的方法是改变单元格的格式: ICell cell = ...; string s = cell.SetCellType(<ICell.CELL_TYPE_STRING-doesn't compile>).ToString(); ICell单元=。。。; string s=cell.SetCellType(这对我来说很有用: string formatProofCellR

我想读取数字单元格的未格式化内容(例如,
0.05
而不是
5%
123456
而不是
123456.000

我认为最简单的方法是改变单元格的格式:

ICell cell = ...;
string s = cell.SetCellType(<ICell.CELL_TYPE_STRING-doesn't compile>).ToString();
ICell单元=。。。;
string s=cell.SetCellType(这对我来说很有用:

string formatProofCellReading(ICell cell)
{
    if (cell == null)
    {
        return "";
    }
    if (cell.CellType == CellType.NUMERIC)
    {
        double d = cell.NumericCellValue;
        return (d.ToString());
    }
    return cell.ToString();
}