MCPcopy
hub / github.com/qax-os/excelize / setArrayFormulaCells

Method setArrayFormulaCells

cell.go:875–896  ·  view source on GitHub ↗

setArrayFormulaCells transform the array formula in all worksheets to the normal formula and set cells in the array formula reference range to the formula as the normal formula.

()

Source from the content-addressed store, hash-verified

873// normal formula and set cells in the array formula reference range to the
874// formula as the normal formula.
875func (f *File) setArrayFormulaCells() error {
876 definedNames := f.GetDefinedName()
877 for _, sheetN := range f.GetSheetList() {
878 ws, err := f.workSheetReader(sheetN)
879 if err != nil {
880 if err.Error() == newNotWorksheetError(sheetN).Error() {
881 continue
882 }
883 return err
884 }
885 for _, row := range ws.SheetData.Row {
886 for _, cell := range row.C {
887 if cell.F != nil && cell.F.T == STCellFormulaTypeArray {
888 if err = ws.setArrayFormula(sheetN, cell.F, definedNames); err != nil {
889 return err
890 }
891 }
892 }
893 }
894 }
895 return nil
896}
897
898// setSharedFormula set shared formula for the cells.
899func (ws *xlsxWorksheet) setSharedFormula(cell, ref string) error {

Callers 2

getCellFormulaMethod · 0.95
TestGetCellFormulaFunction · 0.95

Calls 6

GetDefinedNameMethod · 0.95
GetSheetListMethod · 0.95
workSheetReaderMethod · 0.95
newNotWorksheetErrorFunction · 0.85
setArrayFormulaMethod · 0.80
ErrorMethod · 0.45

Tested by 1

TestGetCellFormulaFunction · 0.76