Wrong data is Generated in pdf format but right in excel(why?)

Jul 24, 2009 at 6:22 AM

I am trying to generate my sqldata in excel and pdf format,  i used PHPExcel 1.6.7 (http://phpexcel.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=10716).

after  that , the data are export in both format but in excel data is in right format in right cell.(for this PHPExcel_Writer_Excel5 class is used)

but in pdf format wrong data are exported as shown in following figure.(for this PHPExcel_Writer_PDF class is used)

actually whats the problem please help me !!!!dhrubasearch@yahoo.com

 

Criteria: -in excel







S.N. Month Male <=20 Female <=20 Male 20 to 40 Female 20 to 40 Male >40 Female >40 Total
1 2009-Apr 0 0 1 3 0 0 4
2 2009-Aug 0 0 1 1 0 0 2
3 2009-Jul 0 1 2 0 0 0 3
4 2009-Jun 0 0 0 1 0 0 1
5 2009-May 0 0 1 1 0 0 2
6 2010-Apr 0 0 1 1 0 0 2
7 2010-Aug 0 0 1 0 0 0 1
8 2011-Apr 0 0 3 7 0 2 12

Grand Total 0 1 10 14 0 2 27

for Excel5

     $objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
        $dir='../web/uploads';
        $report=$item_list['report'][0];        
        $fileName = $report.mt_rand()."-".date('H-i-s-ms').".xls";
        $objWriter->save('../web/uploads/'.$fileName);

        $data = file_get_contents('../web/uploads/'.$fileName);
        $context = sfContext::getInstance();
        $response = $context->getResponse();
        $response->setHttpHeader('Pragma', '');
        $response->setHttpHeader('Cache-Control', '');
        $response->setHttpHeader('Content-Type', 'application/vnd.ms-excel');
        $response->setHttpHeader('Content-Disposition', 'attachment;filename="'.$fileName.'"');
  

for pdf ::       
         $fileName = $report."-".date('H-i-s-ms').".pdf";        
         $objWriter = new PHPExcel_Writer_PDF($objPHPExcel);
         $objWriter->setPreCalculateFormulas(false);
         $objWriter->save('../web/uploads/'.$fileName);
        $data = file_get_contents('../web/uploads/'.$fileName);
        $context = sfContext::getInstance();
        $response = $context->getResponse();
        $response->setHttpHeader('Pragma', '');
        $response->setHttpHeader('Cache-Control', '');
        $response->setHttpHeader('Content-Disposition', 'attachment;filename="'.$fileName.'"');
        $response->setContent($data);

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

Criteria: -in pdf fromat







S.N. Month Male <=20 Female <=20 Male 20 to 40 Female 20 to 40 Male >40 Female >40 Total
1 2009-Apr 1 1 1 3 0 0 4
2 2009-Aug 1 1 1 1 0 0 2
3 2009-Jul 3 3 2 0 0 0 3
4 2009-Jun 3 3 0 1 0 0 1
5 2009-May 5 5 5 1 0 0 2
6 2010-Apr 5 4 6 1 0 0 2
7 2010-Aug 7 5 3 0 0 0 1
8 2011-Apr 5 7 7 7 0 2 12

Grand Total 7 12 10 14 10 7 27
Jul 24, 2009 at 7:20 AM

 Hi dhrubasearch,

This discussion list is for the CodePlex website itself. I recommend you post it on the project's discussion forum instead.

Matt