1. 程式人生 > >2,C#,NPOI2.2.1,.NET 4.0 獲取單元格公式值,設置單元格的格式

2,C#,NPOI2.2.1,.NET 4.0 獲取單元格公式值,設置單元格的格式

idata .data icc == ted bsp taf shee else

//獲取單元格的公式值

String temp;

if (row.GetCell(0).CellType == CellType.Formula)

temp = row.GetCell(0).NumericCellValue.ToString();

else

temp = row.GetCell(0).ToString();

//設置單元格格式為0.00,

IDataFormat dataformat = workbook.CreateDataFormat();

ICellStyle style0 = workbook.CreateCellStyle();

style0.DataFormat = dataformat.GetFormat("0.00");

IRow row = sheet.CreateRow(0);

row.CreateCell(0).CellStyle = style0;

row.GetCell(0).SetCellValue(1);

2,C#,NPOI2.2.1,.NET 4.0 獲取單元格公式值,設置單元格的格式