codeplex phpexcel validation issue for invalid val

2019-08-14 22:18发布

Here's my problem, I have a validation in one of my excel.

    $objValidation = $sheet->getCell('G17' )->getDataValidation();
    $objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_DECIMAL );
    $objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
    $objValidation->setOperator( PHPExcel_Cell_DataValidation::OPERATOR_GREATERTHANOREQUAL);
    $objValidation->setAllowBlank(true);
    $objValidation->setShowInputMessage(true);
    $objValidation->setShowErrorMessage(true);
    $objValidation->setErrorTitle('Input error');
    $objValidation->setError('Only numeric entries are allowed.');
    $objValidation->setFormula1(0);
    $objValidation->setPromptTitle('Allowed input');
    $objValidation->setPrompt('Only numeric entries are allowed.');

When the user try to enter alphabet characters on 'G17' cell, user was prompted by the error message with the following buttons : "OK", "Cancel" , "Help" . please see image provide

error message encountered But when the user clicks the "OK" button, the alphabet entry was accepted.

Is it possible to clear the cellvalue if there is an error in validation or highlight the cell values when there is an error in validation?

Thank you.

0条回答
登录 后发表回答