2012-10-26 24 views
0

我安裝這個套件:PHPExcel捆綁在Symfony2中:PHPExcel_Style_Color錯誤的聲明

https://github.com/liuggio/ExcelBundle

在我的Symfony2,基本上添加:

[PHPExcel] 
    git=http://github.com/PHPOffice/PHPExcel.git 
    target=/phpexcel 
    version=origin/master 

[n3bStreamresponse] 
    git=git://github.com/liuggio/Symfony2-StreamResponse.git 
    target=n3b/src/n3b/Bundle/Util/HttpFoundation/StreamResponse 

[LiuggioExcelBundle] 
    git=https://github.com/liuggio/ExcelBundle.git 
    target=/bundles/Liuggio/ExcelBundle 

到DEPS,更新Autoload.php和AppKernel。 PHP和使用此操作在一個控制器中:

$excelService = $this->get('xls.service_xls2007'); 
    $excelService->excelObj->getProperties() 
         ->setTitle("Reunión comercial") 
         ->setDescription("Reunión Comercial - Generación automática desde la aplicación de RRHH."); 

     $excelService->excelObj->getActiveSheet()->setTitle('Reunión Comercial'); 
     // Set active sheet index to the first sheet, so Excel opens this as the first sheet 
     $excelService->excelObj->setActiveSheetIndex(0); 

    //create the response 
    $response = $excelService->getResponse(); 
    $response->headers->set('Content-Type', 'text/vnd.ms-excel; charset=utf-8'); 
    $response->headers->set('Content-Disposition', 'attachment;filename=reuComercial-'.date("Y_m_d_His").'.xls'); 

    // If you are using a https connection, you have to set those two headers for compatibility with IE <9 
    /*$response->headers->set('Pragma', 'public'); 
    $response->headers->set('Cache-Control', 'maxage=1'); 
    */ 
    $excelService->setActiveSheetIndex(0) 
     ->setCellValue('A1', 'Lead') 
      ->setCellValue('B1', 'Peticion') 
      ->setCellValue('C1', 'Estado Candidato') 
      ->setCellValue('D1', 'Nombre Candidato') 
      ->setCellValue('E1', 'Apellido Candidato') 
      ->setCellValue('F1', 'Cliente') 
      ->setCellValue('G1', 'Descripcion'); 


    $em = $this->getDoctrine()->getEntityManager(); 

    $data = $em->getRepository('OportunidadBundle:Oportunidad')->reunionComercial(); 

    $aux = 2; 
    foreach ($data as $row) 
    { 
     $excelService->setActiveSheetIndex(0) 
      ->setCellValue('A'.$aux, $row->Lead) 
      ->setCellValue('B'.$aux, $row->Peticion) 
      ->setCellValue('C'.$aux, $row->Estado_Candidato) 
      ->setCellValue('D'.$aux, $row->Nombre_Candidato) 
      ->setCellValue('E'.$aux, $row->Apellido_Candidato) 
      ->setCellValue('F'.$aux, $row->Cliente) 
      ->setCellValue('G'.$aux, $row->Descripcion); 
     $aux++; 
    }; 

    $excelService->getStreamWriter()->write($filename); 

    return $response; 

An d我得到這個錯誤:(

Runtime Notice: Declaration of PHPExcel_Style_Color::bindParent() should be compatible with that of PHPExcel_Style_Supervisor::bindParent() in C:\Program Files\EasyPHP-5.3.8.1\www\www\www\intranet\vendor\phpexcel\Classes\PHPExcel\Style\Color.php line 36 

我不知道這意味着什麼,因爲在PHP很多東西仍然逃脫我:/

回答

1

這與拉動最新的開發分支代碼,而問題比標籤版本:開發分支代碼不能保證處於可以簡單運行的狀態。

我修改了bindParent()方法的簽名,以使此特定通知不會再發生