After that I have tried with XSSFWorkBook with this code:

XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet = wb.createSheet("new sheet");
DataValidationHelper validationHelper = new XSSFDataValidationHelper(sheet);
DataValidationConstraint constraint =
validationHelper.createExplicitListConstraint(getCountries());
CellRangeAddressList addressList = new CellRangeAddressList(0, 0, 0, 0);
DataValidation dataValidation =
validationHelper.createValidation(constraint, addressList);
dataValidation.setErrorStyle(DataValidation.ErrorStyle.STOP);
dataValidation.setSuppressDropDownArrow(true);
sheet.addValidationData(dataValidation);
FileOutputStream fileOut = new FileOutputStream("c:\\test.xlsx");

Unfortunately, no success with such result which is comma delimenated long
string in one cell:

[image: enter image description here]

But manually in excel, I can create dropdown cells with long this country
list.
Is there any way generate dropdown with long strings, or API does not
support?

On Wed, Jan 18, 2012 at 3:25 AM, jamshid [via Apache POI] <
[email protected]> wrote:

> Hi, thank you for quick reply
> Sorry I confused giving explanation because I've done with XSSF in that
> time I got comma deliminated String but when I do it with HSSF I'm getting
> *String literals in formulas can't be bigger than 255 characters ASCII*
> for this code:
>
> try {
>     HSSFWorkbook wb = new HSSFWorkbook();
>     HSSFSheet sheet = wb.createSheet("new sheet");
>     HSSFRow row = sheet.createRow((short) 0);
>     //CellRangeAddressList from org.apache.poi.ss.util package
>     CellRangeAddressList addressList = new CellRangeAddressList(0, 0, 0,
> 0);
>     DVConstraint dvConstraint =
> DVConstraint.createExplicitListConstraint(getCountries());
>     DataValidation dataValidation = new HSSFDataValidation(addressList,
> dvConstraint);
>     dataValidation.setSuppressDropDownArrow(false);
>     sheet.addValidationData(dataValidation);
>     FileOutputStream fileOut = new FileOutputStream("c:\\test.xls");
>     wb.write(fileOut);
>     fileOut.close();
>     } catch (IOException e) {
>        e.printStackTrace();
>   }
>
>
> http://stackoverflow.com/questions/8655185/limitation-while-generating-excel-drop-down-list-with-apache-poi
>
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://apache-poi.1045710.n5.nabble.com/Problem-creating-an-excel-cell-with-Drop-Down-Lists-tp5151878p5153136.html
>  To unsubscribe from Problem creating an excel cell with Drop Down Lists, 
> click
> here<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5151878&code=amFtc2hpZC5hc2F0aWxsYXlldkBnbWFpbC5jb218NTE1MTg3OHwxODU3MDg5MTI2>
> .
> NAML<http://apache-poi.1045710.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>


--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Problem-creating-an-excel-cell-with-Drop-Down-Lists-tp5151878p5154747.html
Sent from the POI - User mailing list archive at Nabble.com.

Reply via email to