phpexcel冻结行和列 [英] phpexcel freeze row and columns
问题描述
我正在尝试使用PHPExcel冻结工作表中的第一行和前三列.
I'm trying to freeze the top row and the first 3 columns in a worksheet, using PHPExcel.
我可以毫无问题地冻结行:
I can freeze the row without any problem:
$objPHPExcel->getActiveSheet()->freezePane('A2');
或者我可以毫无问题地冻结该列:
Or I can freeze the column without any problem:
$objPHPExcel->getActiveSheet()->freezePane('D1');
但是当我尝试同时使用两者时,第一个会被第二个覆盖.
But when I try to use both, the first gets over-written by the second.
有什么办法可以在同一张纸上同时使用两者吗?
Is there any way to use both on the same sheet?
谢谢.
推荐答案
我假设您正在尝试冻结列和行.
I assume you're trying to Freeze columns and rows both.
freezePane
显然将覆盖您可能已经为其指定的所有先前参数.
freezePane
will obviously overwrite any previous parameters you might have given to it.
根据您当前的情况,我发现您正在尝试冻结顶行和最左3列
As per your current scenario, I see that you're trying to freeze the top row and the left-most 3 columns
尝试一下:
$objPHPExcel->getActiveSheet()->freezePane('D2');
这将冻结第1行和列A,B& C
这应该可以完成您的工作!
This should get your work done!
注意: freezePane
的工作方式与您在MS Excel中的使用方式完全相同.您选择一个单元格,然后选择冻结.并冻结上面的所有行以及保留在其上的列.
Note: freezePane
works exactly how you use it in MS Excel. You select a cell and select Freeze. And it freezes whatever rows are above it, and the columns which are left to it.
这篇关于phpexcel冻结行和列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!