How to freeze (lock) table header in PHPExcel

黄舟
Release: 2023-03-16 07:38:01
Original
2940 people have browsed it

PHPExcel method to freeze (lock) the header: first create a PHPExcel object; then use [setActiveSheetIndex(0)] and [getActiveSheet()->freezePane('A2')] to freeze the cells .

How to freeze (lock) table header in PHPExcel

How to freeze (lock) the table header in PHPExcel?

The example in this article describes the simple implementation method of freezing (locking) the table header in PHPExcel. Share it with everyone for your reference, the details are as follows:

PHPExcel is a relatively powerful PHP plug-in for operating Microsoft excel. In order to facilitate viewing when exporting data, sometimes it is necessary to lock the table header, that is, scrolling to view When reading data, the header always appears in the field of view and will not disappear.

The calling method is as follows:

$objPHPExcel = new PHPExcel(); $objPHPExcel->setActiveSheetIndex(0); $objPHPExcel->getActiveSheet()->freezePane('A2');
Copy after login

The above code is to freeze the first row of the table. You may have some doubts about this method. Why is it to freeze the first row? The following picture explains it Principle

The picture is a bit ugly, as long as everyone can understand it

For more related knowledge, please visitPHP Chinese website! !

The above is the detailed content of How to freeze (lock) table header in PHPExcel. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!