How to add dropdown list control using PHPExcel

梦想与她 提交于 2019-12-11 03:19:23

问题


How can I add default dropdown in excel sheet using PHPExcel when user add a new row example available for individual cell not for a column or multiple columns. Example of Excel Template

SL No. | First Name | Middle Name | Last Name | Class | Sec | DOB | Father Name | Selected

Class and Sec require dropdown. Hence when a new student record is added class and sec column should have dropdown. Is it possible through PHPExcel.

If someone could provide a tutorial or something, that would be a real help.

Regards


回答1:


This is called an autoFilter, and there's an entire document in the /Documentation folder describing how to set this up - PHPExcel AutoFilter Reference developer documentation

At its simplest, you simply define the entire worksheet as an autofilter area using:

$objPHPExcel->getActiveSheet()->setAutoFilter('A1:I20');

(assuming that 20 is the last row in the worksheet)

or

$objPHPExcel->getActiveSheet()->setAutoFilter(
    $objPHPExcel->getActiveSheet()->calculateWorksheetDimension()
);

if you want to let PHPExcel calculate the range for you



来源:https://stackoverflow.com/questions/21369758/how-to-add-dropdown-list-control-using-phpexcel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!