Freeze Pane Problem

Topics: Developer Forum, User Forum
Apr 29, 2008 at 9:58 PM
I am having an issue setting a pane to be frozen. For example, freezing the top row. Is there an easy way to go about doing this?

Maybe this is a post for the feature request area, but it would be nice to have a:

$objPHPExcel->getActiveSheet()->freezePane('top'); //or
$objPHPExcel->getActiveSheet()->freezePane('left');

or something to that effect.

Anyone have any ideas?

Thanks a bunch for all of your help


Coordinator
Apr 30, 2008 at 1:04 PM
Try the $objPHPExcel->getActiveSheet()->freezePane('A1') option, for example.

Regards,
Maarten
May 1, 2008 at 4:23 PM
I have tried that, but when scrolling down or right the cell does not remain "frozen".

Basically I want to accomplish the same thing as you would by going to View->Freeze Panes->Freeze Top Row

This would be all of row 1, and not just on individual cell. I have also put $objPHPExcel->getActiveSheet()->freezePane('A1') in a loop to freeze all cells from A1 to ZZ1 with the same result.

Thanks again for the time and effort.
May 1, 2008 at 4:30 PM
I think I found what I am doing wrong, but the fix seems a bit odd. In order to freeze row 1, I have to do:
$objPHPExcel->getActiveSheet()->freezePane('A2');

The same is true for the columns, in order to freeze column A, I have to do:
$objPHPExcel->getActiveSheet()->freezePane('B1');

So, combining the two in order to freeze both row 1 and column A, I have to do:
$objPHPExcel->getActiveSheet()->freezePane('B2');


Not certain if this is by design or not, but this seems to do the trick.

Thanks again for the help.



Coordinator
May 2, 2008 at 8:58 AM
This is by design: the OpenXML specs do the same. So basically if you want to freeze column or row X, make sure you freeze X + 1.
Aug 29, 2012 at 12:59 PM

I faced the same problem. Someone should change an example in the source code before of the function definition (Worksheet.php function freezePane).

@param string $pCell Cell (i.e. A1)

which is not working

to A2