我想在使用NPOI庫的Excel中創建雙精度和數字格式單元格。我用這樣的代碼NPOI Excel數字格式不顯示在asp.net中的Excel工作表中
Dim cell As HSSFCell = row.CreateCell(j)
cell.SetCellValue(Double.Parse(dr(col).ToString))
在Excel中數字排列正確的,但是當我在「常規」檢查格式,它顯示
然後我改變了我的代碼,如下圖所示
Dim cell As HSSFCell = row.CreateCell(j)
cell.SetCellValue(Double.Parse(dr(col).ToString))
Dim cellStyle As HSSFCellStyle = hssfworkbook.CreateCellStyle
cellStyle.DataFormat = HSSFDataFormat.GetBuiltinFormat("#,#0.0")
cell.CellStyle = cellStyle
然後,當打開文件時,它給出了錯誤,也花了很長時間打開。但Excel格式顯示在「數字」
錯誤顯示如下。
如何解決這一問題?
您是否使用NPOI 1.6或更高? – James 2010-08-06 16:58:53
1.2.3是最新版本,據我所知:http://npoi.codeplex.com/releases/view/49524 – MikeWyatt 2010-08-30 19:29:48