fix: fix update error

pull/2/head
Imhven 2 years ago
parent df3c50bf20
commit 7483b73191

@ -815,24 +815,19 @@ func (f *File) calcCellValue(ctx *calcContext, sheet, cell string) (result formu
return 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 ( var (
token efp.Token token formulaArg
) )
ps := efp.ExcelParser() ps := efp.ExcelParser()
tokens := ps.Parse(formula) tokens := ps.Parse(formula)
if tokens == nil { if tokens == nil {
return return
} }
if token, err = f.evalInfixExp(sheet, "", tokens); err != nil { if token, err = f.evalInfixExp(ctx, sheet, "", tokens); err != nil {
return return
} }
result = token.TValue result = token.Value()
isNum, precision := isNumeric(result)
if isNum && precision > 15 {
num, _ := roundPrecision(result)
result = strings.ToUpper(num)
}
return return
} }

Loading…
Cancel
Save