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();
}