Beräkna arbetsbokens formler
Contents
[
Hide
]
Beräkna arbetsbokens formler
Använd Workbook.CalculateFormula() metod för att beräkna formlerna i din arbetsbok. Följande exempel visar hur detta används.
Exempelkod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workbook, _ := NewWorkbook() | |
worksheets, _ := workbook.GetWorksheets() | |
worksheet, _ := worksheets.Get_Int(0) | |
cells, _ := worksheet.GetCells() | |
cell, _ := cells.Get_String("A1") | |
cell.PutValue_Int(5) | |
cell, _ = cells.Get_String("A2") | |
cell.PutValue_Int(15) | |
cell, _ = cells.Get_String("A3") | |
cell.PutValue_Int(25) | |
cell, _ = cells.Get_String("A4") | |
cell.SetFormula_String("=SUM(A1:A3)") | |
workbook.CalculateFormula() | |
value, _ := cell.Get_IntValue() | |
println(value) |
Konsoloutput
Detta är konsoloutputen för ovanstående exempelkod.
Calculated Value of Cell A4: 45