Class FormulaUtil


  • public class FormulaUtil
    extends Object
    • Method Detail

      • quoteReference

        public static String quoteReference​(String reference)
      • quoteString

        public static String quoteString​(String text)
      • getReferences

        public static String[] getReferences​(Formula formula)
      • extractFormula

        public static String extractFormula​(String formula)
      • extractStaticTextFromFormula

        public static String extractStaticTextFromFormula​(String formula)
      • extractStaticTextFromFormulaFragment

        public static String extractStaticTextFromFormulaFragment​(String formula)
      • isValidFormulaFragment

        public static boolean isValidFormulaFragment​(String formula)
      • createCellUITextFromFormula

        public static String createCellUITextFromFormula​(String formula)
      • createEditorTextFromFormula

        public static String createEditorTextFromFormula​(String formula,
                                                         FormulaContext formulaContext)
      • createFormulaFromUIText

        public static String createFormulaFromUIText​(String formula)
        Creates a formula fragment from the given UI text. Within the reporting engine, the fragment must be prefixed with a formula-context selector.

        The input follows the Excel/OpenOffice Calc rules: A leading equals indicates a formula, a leading apostrophe indicates a text. Otherwise, if the input is parsable as number it will be formed into a formula that returns that static number, and everything else will be treated as text.

        Note that there is no syntax check for formula input - if the user writes garbage after the formula selector, this garbage will still be treated as formula.

        Parameters:
        formula - the input from the user.
        Returns:
        the normalized formula.
      • extractFormulaContext

        public static String[] extractFormulaContext​(String formula)