cell validation

Topics: Developer Forum, User Forum
Jul 14, 2011 at 2:45 PM

Good morning.
Please could someone tell me why the attached code that activates the validation in cell G11, but only to validate if the data entered is numeric and not validate the range (between 4 and 70)?
If I put numbers, accepts anyone, even outside the range.
If I put letters, not accept them.
Thank you very much.

...
...
$objPHPExcel->setActiveSheetIndex(0);
$objValidation = $objPHPExcel->getActiveSheet()->getCell('G11')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
$objValidation->setOperator( PHPExcel_Cell_DataValidation::OPERATOR_BETWEEN);
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
$objValidation->setAllowBlank(true);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setErrorTitle('Solo numeros entre 4 y 70');
$objValidation->setError('Solo numeros entre 4 y 70!');
$objValidation->setPromptTitle('Datos permitidos');
$objValidation->setPrompt('Solo numeros entre 4 y 70');
$objValidation->setFormula1(4);
$objValidation->setFormula2(70);
...
...

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');