poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre Lavignotte" <pierre.lavigno...@gmail.com>
Subject Re: query regarding HSSFDataValidation
Date Thu, 28 Aug 2008 07:50:42 GMT
I just tried again with a new workbook from scratch.
I filled A1 to A10 with values from 1 to 10 and set the value 3 in B1.

Then I use your example :

String strFormula = "$A$1:$A$10";
int start_row = (short)0;
HSSFDataValidation data_validation = new HSSFDataValidation((short)
(start_row),(short)1,(short)(start_row),(short)1);
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(true);
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 !");
sheet.addValidationData(data_validation);

Excel doesn't crash anymore but there is no drop down list in B1...

But it works if I set a value in C2, the drop down appears and is
correctly filled !!!!

If I use a reference to another sheet, the list is empty, but this is
not allowed by Excel (I use Excel 2003).
If I use a named area reference, the list is empty but if I open the
Data => Validation menu and just click OK, the list is correctly
filled.

I use build poi-3.5-beta1-20080718.

To be continued...
Pierre

On Thu, Aug 28, 2008 at 9:20 AM, mbhatt <mbhatt@solbright.com> wrote:
>
> Hi Pierre,
>
> Make sure that your formula in the data validation is correct (ie. valid
> cell references ), also it wouldn't work across the sheets.  So if u r
> creating a data validation in a sheet for which you are populating the data
> from another sheet, then it wouldn't work.
>
>
>
> Pierre Lavignotte wrote:
>>
>> Hi,
>>
>> I'm also looking for Data Validation with list of values.
>>
>> mbhatt, I tried your exemple but the generated workbook make Excel crash.
>> What can I be missing ?
>>
>> Thanks,
>> Pierre
>>
>> On Thu, Aug 28, 2008 at 6:27 AM, mbhatt <mbhatt@solbright.com> wrote:
>>>
>>> Hi,
>>>
>>> No, this is still a bug that is existing in the 3.1 version.  They
>>> haven't
>>> fixed that yet.
>>>
>>> Thanks.
>>>
>>>
>>> AnuB wrote:
>>>>
>>>> Hi,
>>>>    Did you find any solution for the issue. I am facing the same
>>>> problem.
>>>> I am using 3.1 final version of apache poi api which is the latest
>>>> release. But I still have the issue.
>>>> Thanks in Advance
>>>>
>>>>
>>>> mbhatt wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I am trying to use HSSFDataValidation to generate lists in my workbook
>>>>> dynamically.   The drop-down is populated correctly when i use
>>>>> cell/area
>>>>> references that are within the same sheet.   But if i use a formula
>>>>> that
>>>>> contains another sheet name - e.g. "sheet2!$a$1:$a$10"   , then the
>>>>> drop
>>>>> down doesn't work.
>>>>>
>>>>> Following is the code snippet that I am using:
>>>>>
>>>>>             String strFormula = "metadata!$A$1:$A$10";
>>>>>
>>>>>             int start_row = (short)0;
>>>>>             HSSFDataValidation 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 !");
>>>>>             first_sheet.addValidationData(data_validation);
>>>>>
>>>>> Can anyone please help me on this?
>>>>>
>>>>> Thanks.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/query-regarding-HSSFDataValidation-tp18706750p19194009.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
>>>
>>>
>>
>>
>>
>> --
>> Cordialement,
>> Pierre Lavignotte
>> Ingénieur Conception & Développement
>> http://pierre.lavignotte.googlepages.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
>> For additional commands, e-mail: user-help@poi.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/query-regarding-HSSFDataValidation-tp18706750p19195412.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
>
>



-- 
Cordialement,
Pierre Lavignotte
Ingénieur Conception & Développement
http://pierre.lavignotte.googlepages.com

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


Mime
View raw message