title: How can I add Data Validation in excel files using Apache POI?
body: <p>I'm using Apache POI to create an excel file that contains dropdown lists. However, the dropdowns are still editable and the user will be able to type in values. I've seen in excel that I can display an error message when a user enters a value that is not on the list. Below is the part of the code where I set the constraints.</p>
  
  <pre><code>// Add dropdown for department column
      validationHelper = new XSSFDataValidationHelper(sheet);
      CellRangeAddressList addressList = new CellRangeAddressList(6, 10006, 2, 2);
  // DVConstraint dvConstraint = DVConstraint.createExplicitListConstraint(departmentList);
      constraint = validationHelper.createExplicitListConstraint(departmentList);
      dataValidation = validationHelper.createValidation(constraint, addressList);
      dataValidation.setSuppressDropDownArrow(true);
  
      sheet.addValidationData(dataValidation);
  </code></pre>
  
  <p>I am able to display the list properly, however, it doesn't display an error message. Is it possible to do this? If so, how can I do it? Any help is much appreciated. Thanks.</p>