Chart problem

Topics: Developer Forum, Project Management Forum, User Forum
Sep 28, 2012 at 8:00 AM

when I use my own excle file , then the save file will be open without chart ( error of some part missing in excle ) .

when I use examples .xlsx file every thing is fine , just the colors which i set will change . and colors are very important for me 'cause my chart want's to show 4 color result . and it's funny for red result it's blue , ... .

 

please help

Sep 28, 2012 at 9:05 AM

I attached the result xlsx file

Sep 28, 2012 at 2:36 PM

are you inserting colors caring of alpha channel? are you using setARGB passing only RGB values? Please write sample code..

Sep 29, 2012 at 7:12 PM

I don't know anything about that . i used the code in sample ( just open write sth and save) . pls give me more info

Oct 1, 2012 at 2:02 PM

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



$today = date("Ymd"); 
$target ='Results/';
$fileType = 'Excel2007';  
$InputFileName = $target.'Result.xlsx';  
$OutputFileName =  $target. $today . '_Result.xlsx';

 //Read the file (including chart template)
$objReader = PHPExcel_IOFactory::createReader($fileType);
$objReader->setIncludeCharts(TRUE);
$objPHPExcel = $objReader->load($InputFileName);

 //Change the file
 

$objPHPExcel->setActiveSheetIndex(0)
// Add data
            ->setCellValue('C3','10' )
            ->setCellValue('C4','20' )
            ->setCellValue('C5','30')
            ->setCellValue('C5','40' );

 //Write the file (including chart)

PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, $fileType);
$objWriter->setIncludeCharts(TRUE);
$objWriter->save($OutputFileName);