Lost repeat row setting in PHPExcel_Writer_Excel5

Topics: Developer Forum, User Forum
Jun 25, 2008 at 8:06 PM
Edited Jun 25, 2008 at 8:09 PM
I created an 2007 Excel template file, with repeat row setting inside.  ( I repeat Row 1 to 15)
I used the PHPExcel_Reader_Excel2007 to read and then write it to Excel 2003 immediately.
Finally, the Excel 2003 file missing the Repeat Row setting.

This is my code:
$objReader = new PHPExcel_Reader_Excel2007();
$objPHPExcel  = $objReader->load("spec_template.xlsx");  
$objPHPExcel->setActiveSheetIndex(0);

$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);  


After that, I tried to use $objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 15);        
Failed Aslo.


It is fine if I output to Excel 2007 file.

Is any bugs inside PHPExcel_Writer_Excel5?




My Development environment:
PHPExcel 1.6.2
Fedora 9
php 5.2.6
PEAR 1.7.2
Spreadsheet_Excel_Writer 0.9.1


Coordinator
Jun 26, 2008 at 6:17 AM
That's not implemented. I've created a work item for this http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=6485
Jun 26, 2008 at 8:59 AM
Thanks for your quick reply.

I still have 3 questions

1. $phpSheet->getPageSetup()->isRowsToRepeatAtTopSet() always get false ( the repeat row set in Excel template)
This function only works when   I add  $objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 2);  in my code.

2. it should be $worksheet->repeatRows($repeat[0] -1, $repeat[1] - 1);

3. $worksheet->repeatRows always crash the generated Excel. All format and setting have been lost
Oct 11, 2008 at 10:16 PM
Hi,

Has this been fixed?  I am unable to get rows to repeat at top using PHPExcel 1.6.3 (PHPExcel_Writer_Excel5)

My code is:
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
.... add data to worksheet....
$objPHPExcel->getActiveSheet()->getPageSetup()->setOrientation(PHPExcel_Worksheet_PageSetup::ORIENTATION_LANDSCAPE);
$objPHPExcel->getActiveSheet()->getPageSetup()->setRowsToRepeatAtTopByStartAndEnd(1, 2);

$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save($filename);

... but no rows repeat at top?

Thanks
Developer
Oct 12, 2008 at 12:53 AM
Support for repeating rows and print area was implemented for PHPExcel_Writer_Excel5, but had to be removed again due to the these bugs for PEAR Spreadsheet_Excel_Writer

http://pear.php.net/bugs/bug.php?id=2010
http://pear.php.net/bugs/bug.php?id=2146

(PHPExcel_Writer_Excel5 is based on PEAR Spreadsheet_Excel_Writer)
I just looked at the relevant portions of the code and I now see what the problem is. Unfortunately it's not just a tiny problem, but I'll see what I can do about this although it may take time. Subscribe to this thread, and I'll post back when there is something ready.

Developer
Oct 17, 2008 at 2:57 AM
Update: Fixed per work item 7834
http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=7834