title: Apache POI - Constraint on text length to be 8 OR 10
body: <p>I would like to add the folloqing constraints to a column:</p>
  
  <ol>
  <li><p>text length should be of length 8 OR 10</p></li>
  <li><p>all the digits should be number BUT the type of the column is string</p></li>
  </ol>
  
  <p>Do you think is possible?</p>
  
  <p>Here I have set the column to be string</p>
  
  <pre><code>DataFormat fmt = wb.createDataFormat();
  CellStyle textStyle = wb.createCellStyle();
  textStyle.setDataFormat(fmt.getFormat("@"));
  sheet.setDefaultColumnStyle(1, textStyle);
  </code></pre>
  
  <p>Then I have added the following constraint</p>
  
  <pre><code>XSSFDataValidationConstraint dvConstraint = (XSSFDataValidationConstraint) dvHelper.createTextLengthConstraint(ComparisonOperator.EQUAL, "8", null);
  CellRangeAddressList addressList = new CellRangeAddressList(-1, -1, 1, 1);
  XSSFDataValidation validation = (XSSFDataValidation)dvHelper.createValidation(dvConstraint, addressList);
  validation.setShowErrorBox(true);
  sheet.addValidationData(validation);
  </code></pre>
  
  <p>but is not working and I don't know how to add the constraint that to be equal to 8 or 10, nor that the digits should be numbers.</p>
  
  <p>Thanks a lot</p>