codeplex phpexcel validation issue for invalid values

北慕城南 提交于 2019-12-11 04:56:06

问题


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

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.

来源:https://stackoverflow.com/questions/11465846/codeplex-phpexcel-validation-issue-for-invalid-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!