问题描述
当用户添加可用于单个单元格而不是一列或多列的新行示例时,如何使用PHPExcel在excel工作表中添加默认下拉列表.Excel模板示例
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号|名|中间名|姓氏|班级|秒| DOB |父亲姓名|已选择
SL No. | First Name | Middle Name | Last Name | Class | Sec | DOB | Father Name | Selected
Class和Sec需要下拉列表.因此,当添加新的学生记录时,class和sec列应该具有下拉列表.是否可以通过PHPExcel.
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.
致谢
推荐答案
这称为自动过滤器,并且/Documentation
文件夹中有一个完整的文档,说明如何设置-PHPExcel AutoFilter Reference developer documentation
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');
(假设20是工作表的最后一行)
(assuming that 20 is the last row in the worksheet)
或
$objPHPExcel->getActiveSheet()->setAutoFilter(
$objPHPExcel->getActiveSheet()->calculateWorksheetDimension()
);
如果您想让PHPExcel为您计算范围
if you want to let PHPExcel calculate the range for you
这篇关于如何使用PHPExcel添加下拉列表控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!