poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Beardsley <markbrd...@tiscali.co.uk>
Subject Re: hi, I have a ploblem about produce excel2007 file
Date Tue, 13 Mar 2012 15:28:17 GMT
Please do not take this to be a definitive answer, but that is not how I
would try to build a data validation.

XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet sheet = workbook.createSheet("sheet1");
String[] strs = new String[]{"A", "B", "C"};
CellRangeAddressList regions = new CellRangeAddressList(0, 9, 0, 0);
DataValidationHelper helper = sheet.getDataValidationHelper();
DataValidationConstraint constraint =
helper.createExplicitListConstraint(strs);
DataValidation validation = helper.createValidation(constraint, regions);
sheet.addValidationData(validation);
       
workbook.write(outputStream); 

..and I think that might work for you. Try it and let us know please because
I have just hacked the code together from something else and have not tested
it myself.

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/hi-I-have-a-ploblem-about-produce-excel2007-file-tp5502700p5561293.html
Sent from the POI - User mailing list archive at Nabble.com.

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


Mime
View raw message