Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/06/2013, 21:33
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 7 meses
Puntos: 6
problema para crear tabla con PHPExcel

hola amigos espero me puedan ayudar tengo problemas para imprimir esta tabla con PHPExcel

Código PHP:
Ver original
  1. <table class="table table-bordered table-hover" border="1">
  2.     <tr>
  3.     <td><strong>Tipo de Estaciones</strong></td>
  4.     </tr>
  5.     <?php
  6.     foreach($e2 as $field)
  7.     {
  8.  
  9.             if($area != $field['codigoarea']) { ?>
  10.  
  11.            
  12.             <tr><td><div align=center><strong>&nbsp;</strong></div></td></tr>
  13.                         <?php }
  14.             $area=$field['codigoarea'];
  15.             if($estacion != $field['codigotipoestacion']){ ?>
  16.                 <tr><td><div><strong><?php echo $field['nombreestacion'] ?></strong></div></td></tr>
  17.  
  18.                 <?php }
  19.        
  20.                
  21.             $estacion=$field['codigotipoestacion'];
  22.         }
  23. ?>
  24. <tr>
  25.     <td><strong>Total</strong></td>
  26. </tr>  
  27. </table>


este es mi codigo

Código PHP:
Ver original
  1. require_once("PHPExcel.php");
  2. require_once("PHPExcel/Writer/Excel2007.php");
  3.  
  4. $objPHPExcel = new PHPExcel();
  5.  
  6.  
  7. $objPHPExcel->
  8.     getProperties()
  9.         ->setCreator("TEDnologia.com")
  10.         ->setLastModifiedBy("TEDnologia.com")
  11.         ->setTitle("Exportar Excel con PHP")
  12.         ->setSubject("Documento de prueba")
  13.         ->setDescription("Documento generado con PHPExcel")
  14.         ->setKeywords("usuarios phpexcel")
  15.         ->setCategory("reportes");
  16.         $i= 0;
  17.         foreach($e2 as $field)
  18.     {
  19.  
  20.             if($area != $field['codigoarea']) {
  21.  
  22.         $objPHPExcel->setActiveSheetIndex(0)
  23.             ->setCellValue('B'.$i, $field['nombreestacion']);
  24.  
  25.        
  26.         }  
  27.  
  28.         $estacion=$field['codigotipoestacion'];
  29.  
  30.         $i++;  
  31.     }
  32.  
  33.  
  34.  
  35.  
  36. $objPHPExcel->getActiveSheet()->setTitle('Estaciones');
  37. $objPHPExcel->setActiveSheetIndex(0);
  38.  
  39.  
  40. header('Content-Type: application/vnd.ms-excel');
  41. header('Content-Disposition: attachment;filename="Estaciones.xls"');
  42. header('Cache-Control: max-age=0');
  43.  
  44. $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
  45. $objWriter->save('php://output');