Bug 44304

Summary: How to use the String with comma seperated as Data Validation for Cell
Product: POI Reporter: Lakshmi Narayana <lnarayana_boga>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal CC: lnarayana_boga
Priority: P1    
Version: 3.0-FINAL   
Target Milestone: ---   
Hardware: Other   
OS: Windows XP   
Attachments: Please Help me- How to use POI for data validation with Source as String (having comma seperated strings) instead of formula

Description Lakshmi Narayana 2008-01-27 22:09:40 UTC
Please Provide the solution for giving the String having comma seperated list 
of words as the Data Validation for the Cell in Excel Sheet. 

I am working fine with the follwoing code

		    String strFormula = "$A$10:$A$20";
		    int start_row = (short)0;
		    data_validation = new HSSFDataValidation((short)
(start_row),(short)0,(short)(start_row),(short)0);
		    data_validation.setDataValidationType
(HSSFDataValidation.DATA_TYPE_LIST);
		    data_validation.setFirstFormula(strFormula);
		    data_validation.setSecondFormula(null);
		    data_validation.setExplicitListFormula(true);
		    data_validation.setSurppressDropDownArrow(false);
		    data_validation.setEmptyCellAllowed(false);
		    data_validation.setShowPromptBox(false);
		    data_validation.createErrorBox("Invalid 
input !", "Something is wrong ; check condition !");
		    data_validation.createPromptBox("Hi , dear user !", "So , 
you just selected me ! Thanks !");
		    fSheet.addValidationData(data_validation);


BUT------------------ I need to pass the string having comma seperated , to 
validate the cell ....

Thanks & Regards
Lakshmi Narayana
Comment 1 Lakshmi Narayana 2008-01-27 23:51:00 UTC
Created attachment 21434 [details]
Please Help me- How to use POI for data validation with Source as String (having comma seperated strings) instead of formula

Hi,

Please Help me- 

How to use POI for dqatavalidation with Source as String (having comma
seperated strings) instead of formula


String strFormula = "$A$10:$A$20";
int start_row = (short)0;
data_validation = new
HSSFDataValidation((short)(start_row),(short)0,(short)(start_row),(short)0);
data_validation.setDataValidationType(HSSFDataValidation.DATA_TYPE_LIST);
data_validation.setFirstFormula(strFormula);
data_validation.setSecondFormula(null);
data_validation.setExplicitListFormula(false);
data_validation.setSurppressDropDownArrow(false);
data_validation.setEmptyCellAllowed(false);
data_validation.setShowPromptBox(false);
data_validation.createErrorBox("Invalid input !", "Something is wrong ; check
condition !");
data_validation.createPromptBox("Hi , dear user !", "So , you just selected me
! Thanks !");
fSheet.addValidationData(data_validation);

this is working fine,,,,
but i want to pass the string as comma seperated as the SOURCE for data
validation
Comment 2 Nick Burch 2008-01-28 04:31:20 UTC
Please ask usage questions on the mailing lists