作成日: 2023/05/29 最終更新日: 2023/12/20
文書種別
不具合
状況
修正済み
詳細
ROUND関数が不正な値を返す場合があります。
回避方法
Service Pack 3(v15.0.4803.2012/v15.3.0)で修正済み。
Service Pack 3を適用せずに対処する方法としては、ROUND関数を実装したカスタム関数を使用することで回避可能です。
' Formのロードイベント
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
...
FpSpread1.AddCustomFunction(New CustomRoundFunction())
...
End Sub
' カスタム関数の実装
Public Class CustomRoundFunction
Inherits GrapeCity.CalcEngine.Function
Public Sub New()
MyBase.New("ROUND", 2, 2, GrapeCity.CalcEngine.FunctionAttributes.Number Or GrapeCity.CalcEngine.FunctionAttributes.Spillable)
End Sub
Protected Overrides Function IsArrayParameter(ByVal argIndex As Integer) As Boolean
Return False
End Function
Protected Overrides Sub Evaluate(ByVal arguments As GrapeCity.CalcEngine.IArguments, ByVal result As GrapeCity.CalcEngine.IValue)
Dim context As GrapeCity.CalcEngine.IEvaluationContext = arguments.EvaluationContext
Dim number As Double = arguments(0).GetNumber(context)
Dim number_digits As Integer = context.CastToInt(arguments(1).GetNumber(context))
If context.Error = GrapeCity.CalcEngine.CalcError.None Then
Dim obj As Object = FarPoint.CalcEngine.FunctionInfo.RoundFunction.Evaluate(New Object() {number, number_digits})
result.SetValue(obj)
End If
End Sub
End Class