How to set the # of rows to repeat on top when printing multi page reports

Topics: User Forum
Feb 24, 2014 at 12:31 PM
What command do I need to add to my code which will set the number of rows that will be repeated on the top of each page.

For some reason my exported file repeats the top 8 rows and of course I only want the first row to be repeated.

Here is where I setup my header.
                /*output is an xls spreadsheet*/
                setUpExcel();
                /*
                -----------------------------------------------------------
                MrMrs = 12, First = 15, Last = 25, Company = 40
                Addr1 = 40, Addr2 = 40, City = 20, St = 2
                Zip = 10
                -----------------------------------------------------------
                */
                $objSheet->getColumnDimension('A')->setWidth(12);
                $objSheet->getColumnDimension('B')->setWidth(20);
                $objSheet->getColumnDimension('C')->setWidth(30);
                $objSheet->getColumnDimension('D')->setWidth(45);
                $objSheet->getColumnDimension('E')->setWidth(45);
                $objSheet->getColumnDimension('F')->setWidth(45);
                $objSheet->getColumnDimension('G')->setWidth(25);
                $objSheet->getColumnDimension('H')->setWidth(5);
                $objSheet->getColumnDimension('I')->setWidth(11);
                // write columns headers
                $objSheet->getCell('A1')->setValue('MrMrs');
                $objSheet->getCell('B1')->setValue('First');
                $objSheet->getCell('C1')->setValue('Last');
                $objSheet->getCell('D1')->setValue('Company');
                $objSheet->getCell('E1')->setValue('Address 1');
                $objSheet->getCell('F1')->setValue('Address 2');
                $objSheet->getCell('G1')->setValue('City');
                $objSheet->getCell('H1')->setValue('St');
                $objSheet->getCell('I1')->setValue('Zip');
Feb 24, 2014 at 4:05 PM
For printing you want:

$objSheet->getPageSetup()->setRowsToRepeatAtTop(array(1, 1));

For freezing panes on the screen you want:

$objSheet->freezePane('A2');