Data validation float numbers

Topics: Developer Forum
Jul 20, 2012 at 8:04 PM

Hi, I'm using that:

$objValidation = $objPHPExcel->getActiveSheet()->getCell('D7')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
$objValidation->setError('Digite una nota entre 0.0 y 5.0');
$objValidation->setPromptTitle('Nota permitida');
$objValidation->setPrompt('Solamente la nota entre 0.0 y 5.0 es permitida');

And work very well, but I need validate a number float, example, 0.0 and 5.0, I tested the follow:


And the follow:


But that dont work, ¿can you help me please?.

Jul 20, 2012 at 8:27 PM

Ok, is ready, I change de second linde for the follow:

$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_DECIMAL );

And now that its working, but if the cell is empty the validation dont work... Can´t you help me.