I am creating an excel template which should contain a dropdown list. I see its possible with the phpexcel library (PHPExcel Multiple Dropdown list that dependent). I was w
for maatwebite version V.3.1 use below code
Category::all()
]);
}
public function title(): string
{
return 'bulkupload';
}
public function registerEvents(): array
{
//$event = $this->getEvent();
return [
AfterSheet::class => function (AfterSheet $event) {
/** @var Sheet $sheet */
$sheet = $event->sheet;
/**
* validation for bulkuploadsheet
*/
$sheet->setCellValue('B5', "SELECT ITEM");
$configs = "DUS800, DUG900+3xRRUS, DUW2100, 2xMU, SIU, DUS800+3xRRUS, DUG900+3xRRUS, DUW2100";
$objValidation = $sheet->getCell('B5')->getDataValidation();
$objValidation->setType(DataValidation::TYPE_LIST);
$objValidation->setErrorStyle(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 . '"');
}
];
}
}