previousWorksheet::setSelection (Previous) (Next) Worksheet::thawPanesnext

View this page in Last updated: Tue, 02 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

Worksheet::freezePanes

Worksheet::freezePanes – Set panes and mark them as frozen.

Synopsis

require_once "Spreadsheet/Excel/Writer.php";

void Worksheet::freezePanes ( array $panes )

Description

Set panes and mark them as frozen. One can use this method to mark certain regions in the worksheet so that they are "frozen" in the sense that when scrolling through the worksheet these regions are not affected by the scrolling and remain where they are on the screen. This is the same functionality as provided by Microsoft Excel through the ->Window->Freeze Panes menu command.

Parameter

  • array $panes - This is the only parameter received and is composed of the following: 0 => Vertical split position, 1 => Horizontal split position 2 => Top row visible 3 => Leftmost column visible 4 => Active pane

Note

This function can not be called statically.

Example

Using freezePanes()

<?php
$worksheet 
=& $workbook->addWorksheet("Some Worksheet");

/* ... */

/* This freezes the first six rows of the worksheet: */
$worksheet->freezePanes(array(60));

/* To freeze the first column, one must use the following syntax: */
$worksheet->freezePanes(array(01));
?>

If one needs to further specify the scrolling region, the following syntax can be used:

<?php
/* Freeze the first six rows and start the scrollable region at row nine: */
$worksheet->freezePanes(array(6090));
?>
previousWorksheet::setSelection (Previous) (Next) Worksheet::thawPanesnext

Download Documentation Last updated: Tue, 02 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
Note by: iris.cdm@seznam.cz
Be aware of param syntax, or you may experience some strange excel rendering issues. I.e., you want to freeze everything from 4th row, the following syntax is correct:
$worksheet->freezePanes(4, 0, 4, 0); //fifth param is not neccessary

freezePanes accept this array parameter
@param array $panes This is the only parameter received and is composed of the following:
* 0 => Vertical split position,
* 1 => Horizontal split position
* 2 => Top row visible
* 3 => Leftmost column visible
* 4 => Active pane

Note by: alexdesktop@example.com
$worksheet->freezePanes(array(6, 0));
will give notices about offsets 2 and 3.

Instead, use :

$worksheet->freezePanes(array(6, 0, 0, 0));

as specified here :
http://pear.php.net/bugs/bug.php?id=7315