Worksheet::repeatRows

Worksheet::repeatRows – Set the rows to repeat at the top of each printed page.

Synopsis

require_once "Spreadsheet/Excel/Writer.php";

void Worksheet::repeatRows ( integer $first_row , integer $last_row=NULL )

Description

Set the rows to repeat at the top of each printed page.

Parameter

  • integer $first_row - First row to repeat

  • integer $last_row - Last row to repeat. Optional.

Note

This function can not be called statically.

Example

Using repeatRows()

<?php
  
require_once 'Spreadsheet/Excel/Writer.php';

  
$workbook = new Spreadsheet_Excel_Writer('test.xls');
  
$worksheet =& $workbook->addWorkSheet();
  
$worksheet->setColumn(0,0,100);
  
$worksheet->write(0,0,"99 Bottles Of Beer On The Wall- The Complete Lyrics");
  
// repeat only the first row
  
$worksheet->repeatRows(0);
  for (
$i 99$i 0$i--)
  {
      if (
$i 1) {
          
$next $i 1;
      }
      else {
          
$next "no more";
      }
      
$worksheet->write(100 $i,0,"$i Bottles of beer on the wall, $i bottles of beer, ".
                                   
"take one down, pass it around, ".
                                   
"$next bottles of beer on the wall.");
  }
  
$workbook->close();
?>