PHPExcel how to batch data validation / entire column can be dropped down

PHPExcel can only set one cell to drop-down at a time. I want to set the whole column to drop-down effect. Is it possible?

related codes

/ / Please paste the code text below (do not replace the code with pictures)

$objExcel = new PHPExcel ();
$objWriter = new PHPExcel_Writer_Excel5 ($objExcel);
$objExcel- > setActiveSheetIndex (0);
$objActSheet = $objExcel- > getActiveSheet ();
$objValidation = $objActSheet- > getCell ("A1")-> getDataValidation ();
$objValidation-> setType (PHPExcel_Cell_DataValidation::TYPE_LIST)

       -> setErrorStyle(PHPExcel_Cell_DataValidation::STYLE_INFORMATION)
       -> setAllowBlank(false)
       -> setShowInputMessage(true)
       -> setShowErrorMessage(true)
       -> setShowDropDown(true)
       -> setErrorTitle("")
       -> setError(".")
       -> setPromptTitle("")
       -> setFormula1(""1,2,3"");

I want to set the whole column to the drop-down effect. I don"t know how to do it, but the number of entries inserted in the loop is not fixed.

Aug.05,2021

recommend a feature-rich, compatible and high-performance Excel document base library Excelize: https://github.com/xuri/excelize

Menu