我正在使用PhpSpreadsheet生成报告。但是它无法将方括号值写入单元格下拉列表。单元格在输出中变为空白。值中没有括号,它可以正常工作。
Ex:方括号中的值:$ validation-> setFormula1(“ Item A,Item B,Item(C)”)
$validation = $spreadsheet->getActiveSheet()->getCell($Cell)->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), item6");