setShowSummaryBelow has no effect when generating Excel5 document

Topics: Developer Forum, Project Management Forum, User Forum
Dec 11, 2008 at 11:59 AM
Edited Dec 11, 2008 at 12:04 PM
Hi all,

When grouping rows, I am trying to add a summary above the collapsible rows instead of below.
Here is my code :

<?php

/** Error reporting */
error_reporting(E_ALL);

/** PHPExcel */
include 'PHPExcel.php';

/** PHPExcel_IOFactory */
include 'PHPExcel/IOFactory.php';

// Create new PHPExcel object
echo date('H:i:s') . " Create new PHPExcel object\n";
$objPHPExcel = new PHPExcel();

// Add some data
echo date('H:i:s') . " Add some data\n";
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello');
$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Hello');
$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Hello');
$objPHPExcel->getActiveSheet()->setCellValue('A4', 'Hello');
$objPHPExcel->getActiveSheet()->setCellValue('A5', 'Hello');
$objPHPExcel->getActiveSheet()->setCellValue('A6', 'Hello');
$objPHPExcel->getActiveSheet()->getRowDimension(2)->setOutlineLevel(1);
$objPHPExcel->getActiveSheet()->getRowDimension(2)->setVisible(true);
$objPHPExcel->getActiveSheet()->getRowDimension(3)->setOutlineLevel(1);
$objPHPExcel->getActiveSheet()->getRowDimension(3)->setVisible(true);
$objPHPExcel->getActiveSheet()->getRowDimension(4)->setOutlineLevel(1);
$objPHPExcel->getActiveSheet()->getRowDimension(4)->setVisible(true);

$objPHPExcel->getActiveSheet()->setShowSummaryBelow(false);

// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);

        
// Save Excel 2007 file
echo date('H:i:s') . " Write to Excel5 format\n";
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save(str_replace('.php', '.xls', __FILE__));

// Echo memory peak usage
echo date('H:i:s') . " Peak memory usage: " . (memory_get_peak_usage(true) / 1024 / 1024) . " MB\r\n";

// Echo done
echo date('H:i:s') . " Done writing file.\r\n";
?>

Unfortunatly, the setting as no effect and the summary is always below the collapsible rows. It is working fine with Excel 2007 format.

Any idea ?

Regards,

Nicolas ANTONINI
Dec 11, 2008 at 12:02 PM
Edited Dec 11, 2008 at 12:04 PM
-
Developer
Dec 11, 2008 at 1:52 PM
Implemented per work item #8489
http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=8489

Download latest source at next check out:
http://www.codeplex.com/PHPExcel/SourceControl/ListDownloadableCommits.aspx