Skip to content
Advertisement

Limitation while generating excel drop down list with Apache POI

I’m trying to generate an excel file with some validations, I’ve read the poi dev guides for implementing it. During implementation, I got an exception (String literals in formulas can't be bigger than 255 characters ASCII). POI concatenates all drop down options into ‘0’ deliminated string and checking its length and giving me exception. 🙁
I’m using latest version of POI 3.8 beta 5.
And my code is:

JavaScript

After that I have tried with XSSFWorkBook with this code:

JavaScript

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

enter image description here

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

Advertisement

Answer

I understood it, Excel itself does not allow entering validation range string more than 255 characters, this was not POI limitation. And now I’m using Named Ranges and Named Cells and it’s working properly for me. So I had to put my validation range tokens in another sheet(made hidden) and I referenced desired cell ranges from my real sheet. Here is my working code:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement