【セル型】倍精度型セルでNumberFormatInfo.NumberDecimalDigitsを設定しても反映されない
対象製品
SPREAD for .NET 2.5J Web Forms Edition
発生環境
動作保証環境と同様
状況
修正済み
詳細
SPREADの倍精度型セルでは小数点以下桁数に関して下記の2つのプロパティが提供されていますが、(b)を使用した場合、設定が反映されません。
(a) DoubleCellTypeDoubleCellType.DecimalDigitsプロパティ
(b) DoubleCellType.NumberFormatInfoプロパティで指定できるNumberFormatInfo.NumberDecimalDigitsプロパティ
[再現手順]
1.新規WebフォームにSPREADとButtonを配置します
2.下記サンプルコードをコピーします
3.アプリケーションを実行します
4.A1セルが「9999.120」と表示されます
5.Buttonを押下します
6.Excelファイルでは「9999.12」と表示されます
[サンプルコード]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then
Return
End If
Dim db1 As New FarPoint.Web.Spread.DoubleCellType
Dim ninfo As Globalization.NumberFormatInfo = CType(Globalization.CultureInfo.CurrentCulture.NumberFormat.Clone(), Globalization.NumberFormatInfo)
ninfo.NumberDecimalDigits = 3
db1.NumberFormat = ninfo
Dim db2 As New FarPoint.Web.Spread.DoubleCellType
db2.DecimalDigits = 3
FpSpread1.Sheets(0).Columns(0).CellType = db1
FpSpread1.Sheets(0).Cells(0, 0).Value = 9999.123 'A1
FpSpread1.Sheets(0).Columns(1).CellType = db2
FpSpread1.Sheets(0).Cells(0, 1).Value = 9999.123 'B1
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fp As String = HttpContext.Current.Server.MapPath(Request.ApplicationPath + "/test.xls")
FpSpread1.SaveExcel(fp)
End Sub
(a) DoubleCellTypeDoubleCellType.DecimalDigitsプロパティ
(b) DoubleCellType.NumberFormatInfoプロパティで指定できるNumberFormatInfo.NumberDecimalDigitsプロパティ
[再現手順]
1.新規WebフォームにSPREADとButtonを配置します
2.下記サンプルコードをコピーします
3.アプリケーションを実行します
4.A1セルが「9999.120」と表示されます
5.Buttonを押下します
6.Excelファイルでは「9999.12」と表示されます
[サンプルコード]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Page.IsPostBack Then
Return
End If
Dim db1 As New FarPoint.Web.Spread.DoubleCellType
Dim ninfo As Globalization.NumberFormatInfo = CType(Globalization.CultureInfo.CurrentCulture.NumberFormat.Clone(), Globalization.NumberFormatInfo)
ninfo.NumberDecimalDigits = 3
db1.NumberFormat = ninfo
Dim db2 As New FarPoint.Web.Spread.DoubleCellType
db2.DecimalDigits = 3
FpSpread1.Sheets(0).Columns(0).CellType = db1
FpSpread1.Sheets(0).Cells(0, 0).Value = 9999.123 'A1
FpSpread1.Sheets(0).Columns(1).CellType = db2
FpSpread1.Sheets(0).Cells(0, 1).Value = 9999.123 'B1
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fp As String = HttpContext.Current.Server.MapPath(Request.ApplicationPath + "/test.xls")
FpSpread1.SaveExcel(fp)
End Sub
回避方法
2007/09/05版で修正済み。
キーワード
SPRN05885
この文書は、以前は次のバグレポートIDで公開されていました : 6982