Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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?

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
402 views
Welcome To Ask or Share your Answers For Others

1 Answer

I assume you're trying to Freeze columns and rows both.

freezePane will obviously overwrite any previous parameters you might have given to it.

As per your current scenario, I see that you're trying to freeze the top row and the left-most 3 columns

Try this:

$objPHPExcel->getActiveSheet()->freezePane('D2');

This will freeze Row 1 and Columns A,B & C

This should get your work done!

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...