PHPExcel: My result file not same a templates

Feb 7, 2014 at 11:54 PM
on this moment I'm using the PHPExcel library to generate reports in excel from a stored template on my server

my problem is that the graph on the generated file has not same style as my template.

I show you attached template file and the result

Template:
Image

Resulat:
Image
/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Europe/London');

define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');

/** Include PHPExcel */
require_once '../Classes/PHPExcel.php';
include '../Classes/PHPExcel/IOFactory.php';

$inputFileType = 'Excel2007';
$inputFileNames = 'dada.xlsx';

    $objReader = PHPExcel_IOFactory::createReader($inputFileType);
    $objReader->setIncludeCharts(TRUE);

    $objPHPExcel = $objReader->load($inputFileNames);
    //$objPHPExcel->setActiveSheetIndex(0);

$query = "SELECT SQL_CALC_FOUND_ROWS UCASE(lib_cause) as lib_cause,COUNT( CASE WHEN id_panne IS NOT NULL THEN 0 END ) AS DD_ES,COUNT( CASE WHEN abreviation = 'aet' THEN 0  END ) AS AET,COUNT( CASE WHEN abreviation = 'arz' THEN 0 END ) AS ARZ,COUNT( CASE WHEN abreviation = 'ess' THEN 0 END ) AS ESS,COUNT( CASE WHEN abreviation = 'gdy' THEN 0 END ) AS GDY FROM ( SELECT id_panne,cause FROM suipbdd.intervention inner JOIN appel ON ( intervention.id_panne = appel.id_call ) WHERE ras ='' AND date_creat BETWEEN  '$openDate' AND  '$closeDate') AS bnnbbn RIGHT JOIN cause ON ( bnnbbn.cause = cause.id_cause ) LEFT JOIN appel ON ( bnnbbn.id_panne = appel.id_call ) LEFT JOIN agence ON ( appel.agence = agence.id_ag ) GROUP BY lib_cause ORDER BY lib_cause ASC , abreviation ASC ";

$result = mysql_query($query) or die(mysql_error());

$rowCount = 2;

while($row = mysql_fetch_array($result)){
    $objPHPExcel->getActiveSheet()->SetCellValue('A'.$rowCount, $row['lib_cause']);
    $objPHPExcel->getActiveSheet()->SetCellValue('B'.$rowCount, $row['DD_ES']);
    $objPHPExcel->getActiveSheet()->SetCellValue('C'.$rowCount, $row['AET']);
    $objPHPExcel->getActiveSheet()->SetCellValue('D'.$rowCount, $row['ARZ']);
    $objPHPExcel->getActiveSheet()->SetCellValue('E'.$rowCount, $row['ESS']);
    $objPHPExcel->getActiveSheet()->SetCellValue('F'.$rowCount, $row['GDY']);


    $rowCount++;
}
header("Content-Type: application/vnd.ms-excel");
header('Cache-Control: max-age=0');
header("content-disposition: attachment;filename=chartData.xlsx");

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->setIncludeCharts(TRUE);
$objWriter->save('php://output');
Feb 9, 2014 at 8:19 PM
up