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.
()
| 873 | // normal formula and set cells in the array formula reference range to the |
| 874 | // formula as the normal formula. |
| 875 | func (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. |
| 899 | func (ws *xlsxWorksheet) setSharedFormula(cell, ref string) error { |