Actual data is not export in pdf file format, why?

Topics: Developer Forum, Project Management Forum, User Forum
Jul 27, 2009 at 5:41 AM
Edited Jul 27, 2009 at 5:44 AM

 

now i am working in symfony framework, during database data's report generating, i was easily generate excel report.

but now i am trying to generate pdf report by using same classes, PHPExcel1.6.7(http://phpexcel.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=10716)

i got some error when data is exported to pdf.

after generating greater than 3*3 matrix data, single value( mainly zero '0' ) is replaced by other value. but string value is in right condition.i

i thing its a bug of PHPExcel_Writer_PDF($objPHPExcel) class.

read my follwing code carefully mainly  cell's input value and generated correponding output in pdf format.

// Create new PHPExcel object

     $objPHPExcel = new sfPhpExcel();
        
        $objPHPExcel->getActiveSheet()->setCellValue('A1','Report1:');
        $objPHPExcel->getActiveSheet()->setCellValue('A2','Report2:');
        $objPHPExcel->getActiveSheet()->setCellValue('A3','Report3:');        
        $objPHPExcel->getActiveSheet()->setCellValue('A4','Report4:');
        $objPHPExcel->getActiveSheet()->setCellValue('A5','Report5:');
                
        $objPHPExcel->getActiveSheet()->setCellValue('B1', "0");
        $objPHPExcel->getActiveSheet()->setCellValue('B2',"0");
        $objPHPExcel->getActiveSheet()->setCellValue('B3',"0");        
        $objPHPExcel->getActiveSheet()->setCellValue('B4',"0");        
        $objPHPExcel->getActiveSheet()->setCellValue('B5',"5");        
        
        $objPHPExcel->getActiveSheet()->setCellValue('C1', "5");
        $objPHPExcel->getActiveSheet()->setCellValue('C2',"6");
        $objPHPExcel->getActiveSheet()->setCellValue('C3',"7");        
        $objPHPExcel->getActiveSheet()->setCellValue('C4',"8");
        $objPHPExcel->getActiveSheet()->setCellValue('C5',"0");
        $objPHPExcel->getActiveSheet()->setCellValue('D1', "9");
        $objPHPExcel->getActiveSheet()->setCellValue('D2',"10");
        $objPHPExcel->getActiveSheet()->setCellValue('D3',"12");        
        $objPHPExcel->getActiveSheet()->setCellValue('D4',"13");        
        $objPHPExcel->getActiveSheet()->setCellValue('D5',"14");
    $fileName = "-".date('H-i-s-ms').".pdf";        
         $objWriter = new PHPExcel_Writer_PDF($objPHPExcel);
        // $objWriter->writeAllSheets();
        // $objWriter->setSheetIndex(0);
         //$objWriter->setPreCalculateFormulas(false);
         $objWriter->save('../web/uploads/'.$fileName);
        $data = file_get_contents('../web/uploads/'.$fileName);
        $context = sfContext::getInstance();
        $response = $context->getResponse();
        //$response = $this->getContext()->getResponse();
        $response->setHttpHeader('Pragma', '');
        $response->setHttpHeader('Cache-Control', '');
        $response->setHttpHeader('Content-Disposition', 'attachment;filename="'.$fileName.'"'); 

//output: wrong data at B4 and C5 here (for example) if you have any solution, please help me

<!-- BODY,DIV,TABLE,THEAD,TBODY,TFOOT,TR,TH,TD,P { font-family:"Calibri"; font-size:x-small } -->

Report1: 0 5 9
Report2: 0 6 10
Report3: 0 7 12
Report4: 6 8 13
Report5: 5 12 14
Developer
Jul 27, 2009 at 10:56 PM

>> after generating greater than 3*3 matrix data, single value( mainly zero '0' )
>> is replaced by other value. but string value is in right condition


We were recently informed of a bug that looks very similar to your case. It turned out to be a bug in TCPDF which has now been fixed.
http://phpexcel.codeplex.com/WorkItem/View.aspx?WorkItemId=10340

Can you try with latest source code instead of PHPExcel 1.6.7 ? I think the bug will be gone.
http://phpexcel.codeplex.com/SourceControl/ListDownloadableCommits.aspx