Class DVConstraint

    • Method Detail

      • createFormulaListConstraint

        public static DVConstraint createFormulaListConstraint​(java.lang.String listFormula)
      • createExplicitListConstraint

        public static DVConstraint createExplicitListConstraint​(java.lang.String[] explicitListValues)
      • createTimeConstraint

        public static DVConstraint createTimeConstraint​(int comparisonOperator,
                                                        java.lang.String expr1,
                                                        java.lang.String expr2)
        Creates a time based data validation constraint. The text values entered for expr1 and expr2 can be either standard Excel formulas or formatted time values. If the expression starts with '=' it is parsed as a formula, otherwise it is parsed as a formatted time. To parse formatted times, two formats are supported: "HH:MM" or "HH:MM:SS". This is contrary to Excel which uses the default time format from the OS.
        Parameters:
        comparisonOperator - constant from DataValidationConstraint.OperatorType enum
        expr1 - date formula (when first char is '=') or formatted time value
        expr2 - date formula (when first char is '=') or formatted time value
      • createDateConstraint

        public static DVConstraint createDateConstraint​(int comparisonOperator,
                                                        java.lang.String expr1,
                                                        java.lang.String expr2,
                                                        java.lang.String dateFormat)
        Creates a date based data validation constraint. The text values entered for expr1 and expr2 can be either standard Excel formulas or formatted date values. If the expression starts with '=' it is parsed as a formula, otherwise it is parsed as a formatted date (Excel uses the same convention). To parse formatted dates, a date format needs to be specified. This is contrary to Excel which uses the default short date format from the OS.
        Parameters:
        comparisonOperator - constant from DataValidationConstraint.OperatorType enum
        expr1 - date formula (when first char is '=') or formatted date value
        expr2 - date formula (when first char is '=') or formatted date value
        dateFormat - ignored if both expr1 and expr2 are formulas. Default value is "YYYY/MM/DD" otherwise any other valid argument for SimpleDateFormat can be used
        See Also:
        SimpleDateFormat
      • createCustomFormulaConstraint

        public static DVConstraint createCustomFormulaConstraint​(java.lang.String formula)
      • isListValidationType

        public boolean isListValidationType()
        Convenience method
        Returns:
        true if this constraint is a 'list' validation
      • isExplicitList

        public boolean isExplicitList()
        Convenience method
        Returns:
        true if this constraint is a 'list' validation with explicit values
      • getValue1

        public java.lang.Double getValue1()
        Returns:
        the numeric value for expression 1. May be null
      • setValue1

        public void setValue1​(double value1)
        Sets a numeric value for expression 1.
      • getValue2

        public java.lang.Double getValue2()
        Returns:
        the numeric value for expression 2. May be null
      • setValue2

        public void setValue2​(double value2)
        Sets a numeric value for expression 2.