Ver Mensaje Individual
  #5 (permalink)  
Antiguo 28/11/2015, 08:56
Avatar de shake2427
shake2427
 
Fecha de Ingreso: julio-2011
Mensajes: 116
Antigüedad: 12 años, 10 meses
Puntos: 3
Respuesta: libreria phpexcel error

Cita:
Iniciado por oggy_15_3 Ver Mensaje
Y si pones tu parte de tu script.
Quizás haya algo malo en ello.
Que versión del PHPExcel usas?
hola

mira este es el script, uso la version 1.7.9

Código PHP:
Ver original
  1. if (file_exists(ROOT . 'views/laborescampo/adjuntos' . DS . $nombre)) {
  2.                         //Se incluyen las librerias
  3.                     $this->getLibrary('PHPExcel/IOFactory');
  4.                     //Se lee el archivo de excel
  5.                     $objPHPExcel = PHPExcel_IOFactory::load(ROOT .'views/laborescampo/adjuntos' . DS . $nombre);
  6.                    
  7.                    
  8.        
  9.     $objPHPExcel->setActiveSheetIndex(0);
  10.     $hoja_archivo = $objPHPExcel->getActiveSheet();
  11.     $nrofilas = $hoja_archivo->getHighestRow();
  12.     $valorCeldas = array();
  13.    
  14.     for ($i = 2; $i <= $nrofilas; $i++) {
  15.        
  16.         $valorCeldas[] = array(
  17.             'codigo_labor' => $hoja_archivo->getCell('A' . $i)->getCalculatedValue(),
  18.             'descripcion_labor' => $hoja_archivo->getCell('B' . $i)->getCalculatedValue(),
  19.             'codigo_servicio' => $hoja_archivo->getCell('C' . $i)->getCalculatedValue(),
  20.             'labores' => $hoja_archivo->getCell('D' . $i)->getCalculatedValue(),
  21.             'prioridad' => $hoja_archivo->getCell('E' . $i)->getCalculatedValue(),
  22.             'und_labor' => $hoja_archivo->getCell('F' . $i)->getCalculatedValue(),
  23.             'riop' => $hoja_archivo->getCell('G' . $i)->getCalculatedValue(),
  24.             'cast' => $hoja_archivo->getCell('H' . $i)->getCalculatedValue(),
  25.             'observaciones' => $hoja_archivo->getCell('I' . $i)->getCalculatedValue(),
  26.             'frecuencia' => $hoja_archivo->getCell('J' . $i)->getCalculatedValue(),
  27.             'tipo_labor' => $hoja_archivo->getCell('K' . $i)->getCalculatedValue(),
  28.             'edad_labor' => $hoja_archivo->getCell('L' . $i)->getCalculatedValue(),
  29.             'tercero' => $hoja_archivo->getCell('M' . $i)->getCalculatedValue(),
  30.             'desde' => $hoja_archivo->getCell('N' . $i)->getCalculatedValue(),
  31.             'hasta' => $hoja_archivo->getCell('O' . $i)->getCalculatedValue()
  32.         );
  33.     }


mira que ensaye escribiendo la linea que me dijiste y ahi si me funciona, pero creo que esta no es la funcion mas adeacuada por que si me sale ese error con solo 3 lineas como sera cuando tenga miles.
no sabes alguna funcion de quitarle el formato o estilos que tenga el excel cuando estoy leyendo el archivo, por que es como este archivo me lo mandan de una aplicacion externa ese programa le aplica todo tipo de formatos al excel.