Import an Excel table to phpmyadmin while maintaining text formats

0

I want to import an Excel table to phpmyadmin keeping italic and bold formats. (I've got everything I need except to keep the text formats).

I have the following:

  • Through a form the client inserts the Excel file
  • With phpExcel I scroll through the data for import.
  • I show the table on screen.
  • I insert the data in the phpmyadmin table.
  • I have read in several forums that in phpExcel there are instructions of type "getRichTextElements ()" but after many (muuuchas) tests I can not make it work, so something must be doing wrong.

    This is the code. Could someone tell me what I should add to implement the import of styles?

    require_once 'Classes/PHPExcel/IOFactory.php';
    			
    //extraer los datos del excel
    $objPHPExcel = PHPExcel_IOFactory::load('xls/tabla.xls');
    $objHoja=$objPHPExcel->getActiveSheet()->toArray(true,true,true,true);	 
    			
    //mostrar en pantalla la tabla importada
    echo '
      <table border="1" width="100%">
    	<thead>
    		<tr>
    			<th><center><strong>B</strong></center></th>
    			<th><center><strong>C</strong></center></th>
    			<th><center><strong>D</strong></center></th>
    			<th><center><strong>E</strong></center></th>
    		</tr>
    						
    		<tr>
    			<th>DATO1</th>
    			<th>DATO2</th>
    			<th>DATO3</th>
    			<th>DATO4</th>
    		</tr>
    	</thead>
    							
    	<tbody>	 ';
    			
    foreach ($objHoja as $iIndice=>$objCelda) {
    echo '
    	    <tr>
    		    <td>'.$objCelda['B'].'</td>
    			<td>'.$objCelda['C'].'</td>
    			<td>'.$objCelda['D'].'</td>
    			<td>'.$objCelda['E'].'</td>
    	    </tr>
    	';
    //guardar los datos para insertarlos en la tabla del servidor		
    $dato1=$objCelda['B'];
    $dato2=$objCelda['C'];		
    $dato3=$objCelda['D'];
    $dato4=$objCelda['E'];	
    				
    $sql="INSERT INTO mitabla (dato1, dato2, dato3, dato4) VALUES ('$dato1', '$dato2', '$dato3, '$dato4')";
    mysqli_query($conect,$sql);
    			}
    echo '</tbody>
       </table>';
    }
    ?>
        
    asked by Maria 15.07.2016 в 18:00
    source

    1 answer

    -1

    Solution: link

    There they apply it with the getStyle() of the sheet that is active.

        
    answered by 15.07.2016 в 18:25