diff --git a/calc.go b/calc.go index 532b7a4..6c0a3b0 100644 --- a/calc.go +++ b/calc.go @@ -815,24 +815,19 @@ func (f *File) calcCellValue(ctx *calcContext, sheet, cell string) (result formu return } -func (f *File) CalcFormulaValue(sheet, formula string) (result string, err error) { +func (f *File) CalcFormulaValue(ctx *calcContext, sheet, formula string) (result string, err error) { var ( - token efp.Token + token formulaArg ) ps := efp.ExcelParser() tokens := ps.Parse(formula) if tokens == nil { return } - if token, err = f.evalInfixExp(sheet, "", tokens); err != nil { + if token, err = f.evalInfixExp(ctx, sheet, "", tokens); err != nil { return } - result = token.TValue - isNum, precision := isNumeric(result) - if isNum && precision > 15 { - num, _ := roundPrecision(result) - result = strings.ToUpper(num) - } + result = token.Value() return }