Protected sheet + Unprotected cell + Data Validation = Crash Excel

Topics: Developer Forum, User Forum
Feb 24, 2009 at 5:57 PM

The following code will make Microsoft Excel 2007 crash:
set_include_path(get_include_path() . PATH_SEPARATOR . '../functies/');
include 'PHPExcel.php';
include 'PHPExcel/IOFactory.php';

$report = new PHPExcel();




$objValidation = $report->getActiveSheet()->getCell('B3')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_WHOLE );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_STOP );
$objValidation->setErrorTitle('Fout bij ingeven');
$objValidation->setError('Uw invoer is niet geldig.');
$objValidation->setPromptTitle('Toegestane invoer');
$objValidation->setPrompt('Enkel cijfers tussen 0 en 10 zijn toegelaten.');

header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="myfile.xlsx"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($report, 'Excel2007');

So what I do is: I create a new protected worksheet, and unprotect cell B3.
Then I make sure that the input of B3 is validated. (a number between 0 and 10). This makes Excel crash.

Does anybody has an idea what goes wrong? Is it a bug?

I accidently made a bug report with the text above. I intended to make a thread instead of a bug report. But if it's a bug, maybe that was the right thing to do. If not, I'm really sorry
Feb 24, 2009 at 6:49 PM
I believe we need to take some action on this. Thank you for your report.