是否可以创建多选下拉列表?
Excel允许使用VBA创建下拉选项,但我没有找到生成excel的选项,并使用PhpSpreadsheet添加了多选下拉列表。
我发现样品只有一次下拉。
$validation = $spreadsheet->getActiveSheet()->getCell('B5')->getDataValidation();
$validation->setType( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::TYPE_LIST );
$validation->setErrorStyle( \PhpOffice\PhpSpreadsheet\Cell\DataValidation::STYLE_INFORMATION );
$validation->setAllowBlank(false);
$validation->setShowInputMessage(true);
$validation->setShowErrorMessage(true);
$validation->setShowDropDown(true);
$validation->setErrorTitle('Input error');
$validation->setError('Value is not in list.');
$validation->setPromptTitle('Pick from list');
$validation->setPrompt('Please pick a value from the drop-down list.');
$validation->setFormula1('"Item A,Item B,Item C"');
https://phpspreadsheet.readthedocs.io/en/develop/topics/recipes/