poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Goris, Jason" <Jason.Go...@crowncastle.com>
Subject XSSF Data Validation in POI 3.7
Date Tue, 21 Sep 2010 20:05:07 GMT
Has anyone been able to successfully get an XSSF Data Validation example working using POI
3.7 (beta 2) in Java?   I'm trying to create a simple drop down list of names in cell A1...

I have tried something like this:

final XSSFWorkbook wb = new XSSFWorkbook();
final XSSFSheet sheet = wb.createSheet("Project Data");
final Row r = sheet.createRow(0);
final Cell cell = r.createCell(0);

final String[] excelListValues = new String[] { "Robin", "Chris", "Jason", "Rajat", "Greg"
final XSSFDataValidationHelper h = new XSSFDataValidationHelper(sheet);
final CellRangeAddressList addressList = new CellRangeAddressList(0, 0, 0, 0);
final DataValidationConstraint dvConstraint = h.createExplicitListConstraint(excelListValues);
final DataValidation dataValidation = h.createValidation(dvConstraint, addressList);

and wrote out the file, but when I open it in Excel, there is no data validation.  If I literally
change the "XSSF"s to "HSSF"s above, it works fine when reading it back to Excel...e.g. the
list shows up.

Any help/examples would be appreciated.



This email may contain confidential or privileged material.  Use or disclosure of it by anyone
other than the recipient is unauthorized.  If you are not an intended recipient, please delete
this email.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message