On Thu, 16 Mar 2017, Blake Watson wrote:
Is there any way to say:
1) Can I put value x into cell c without violating any data validations the
cell has? e.g.

c.setCellValueWithValidation(v); //only replaces value if v conforms,
otherwise error

I don't think so. CellUtil would probably be where I'd expect to see that sort of method (it has similar helpful wrappers), but no DV stuff yet

2) Does value x conform to specific data validation v? e.g.

v.valueConforms(x); //true if it would be okay to put this value in, false
otherwise

Arrays.asList(
   DataValidationEvaluator.getValidationForCell(ref).
        getValidationConstraint().getExplicitListValues()
).contains(value)

should get you almost all the way there, I think?

(Handy helper method on DataValidationEvaluator or similar might be good though!)

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@poi.apache.org
For additional commands, e-mail: user-h...@poi.apache.org

Reply via email to