PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, October 4, 2022

[FIXED] How to add dropdown list control using PHPExcel

 October 04, 2022     phpexcel     No comments   

Issue

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


Solution

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



Answered By - Mark Baker
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing