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:
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>';
}
?>