Ver Mensaje Individual
  #5 (permalink)  
Antiguo 01/08/2012, 14:27
El_LoBooo
 
Fecha de Ingreso: junio-2012
Mensajes: 46
Antigüedad: 14 años, 4 meses
Puntos: 0
Respuesta: Problema con PHPExcel (clase Excel2007)

Me ha venido la inspiración, parece que ya controlo los mensajes tanto si existe en el fichero o viceversa:

Código PHP:
    $prueba = false;            
    for (
$row = 0; $row <= $highestRow; $row++) {
        
$usuario = $objPHPExcel->getActiveSheet()->getCell('A'.$row)->getValue();
        
        if (
$id == $usuario) {
            
$expediente = $objPHPExcel->getActiveSheet()->getCell('B'.$row)->getValue();
            echo 
"<br>&nbsp;&nbsp;&nbsp;Número de expediente: " . "<b>$expediente</b>";
            
$col = 2;
            
$table = "<div align='center'><br>";
            
$table .= "<table>";
            
$table .= "<tr align='center'>";
            for (
$col = 2; $col <= 10; $col++) { 
                
$materias = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col,1)->getValue();
                
$table .= "<th width='75'>$materias</th>";                    
            }
            
$table .= "<tr align='center'>";
            for (
$col = 2; $col <= 10; $col++) {    
                
$notas = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($col,$row)->getValue();         
                
$table .= "<td width='75'>$notas</td>";
            }
            
$table .= "<tr>";
            
$prueba = true;
        }        
    }
    if (
$prueba == false) {
        if (
$id != $usuario) {
                
$table1 = "<div align='center'><br>";
                
$table1 .= "<table>";
                
$table1 .= "<tr align='center'>";
                
$table1 .= "<th width='400'>No hay notas disponibles</th>";
                
$table1 .= "</tr>";
                
$table1 .= "</table>";
                
$table1 .= "</div>";
                echo 
$table1;
                
$prueba = true;
        }
    } 
De todas formas si veis algún error no dudeis en decírmelo.

Quedaría el tema para que en el for no tenga que poner un número entero, sino que lo cogiera desde la variable $highestColumn.

Un saludo.