I'm running into the following problem.
Im trying to get some results from my database and I want to insert the results into a dropdown list.
In the examle file was the following example:
$objValidation->setFormula1('"Item A,Item B,Item C"');
so the results have to be comma seperated and the total results have to be between "".
Here is the code so far:
$configurations = Db::getInstance()->queryResults('SELECT * FROM configurations', array($siteNumber));
$objPHPExcel->getActiveSheet()->setCellValue('B7', "List:");
$configs = '"';
foreach($configurations as $config) {
$configs .= $config->configuration_name . ', ';
}
$configs .= '"';
$objValidation = $objPHPExcel->getActiveSheet()->getCell('B8')->getDataValidation();
$objValidation->setType( PHPExcel_Cell_DataValidation::TYPE_LIST );
$objValidation->setErrorStyle( PHPExcel_Cell_DataValidation::STYLE_INFORMATION );
$objValidation->setAllowBlank(false);
$objValidation->setShowInputMessage(true);
$objValidation->setShowErrorMessage(true);
$objValidation->setShowDropDown(true);
$objValidation->setErrorTitle('Input error');
$objValidation->setError('Value is not in list.');
$objValidation->setPromptTitle('Pick from list');
//$objValidation->setPrompt('Please pick a value from the drop-down list.');
$objValidation->setFormula1($configs);
Anybody has an idea why the dropdownlist does not get populated??
Thanks in advance!
Dump database results:
string(3100) "item1, item2, item3 etc etc"