transformArrayFormula transforms an array formula to the normal formula by giving a formula tokens list and formula operand tokens list.
(tokens []efp.Token, afs []arrayFormulaOperandToken)
| 543 | // transformArrayFormula transforms an array formula to the normal formula by |
| 544 | // giving a formula tokens list and formula operand tokens list. |
| 545 | func transformArrayFormula(tokens []efp.Token, afs []arrayFormulaOperandToken) string { |
| 546 | var val string |
| 547 | for i, token := range tokens { |
| 548 | var skip bool |
| 549 | for _, af := range afs { |
| 550 | if af.operandTokenIndex == i { |
| 551 | val += af.sheetName + af.targetCellRef |
| 552 | skip = true |
| 553 | break |
| 554 | } |
| 555 | } |
| 556 | if skip { |
| 557 | continue |
| 558 | } |
| 559 | if paren := transformParenthesesToken(token); paren != "" { |
| 560 | val += transformParenthesesToken(token) |
| 561 | continue |
| 562 | } |
| 563 | if token.TType == efp.TokenTypeOperand && token.TSubType == efp.TokenSubTypeText { |
| 564 | val += string(efp.QuoteDouble) + strings.ReplaceAll(token.TValue, "\"", "\"\"") + string(efp.QuoteDouble) |
| 565 | continue |
| 566 | } |
| 567 | val += token.TValue |
| 568 | } |
| 569 | return val |
| 570 | } |
| 571 | |
| 572 | // getArrayFormulaTokens returns parsed formula token and operand related token |
| 573 | // list for in array formula. |
no test coverage detected