PHPExcel fills accents as false

I have a problem with the PHPExcel 1.7.9 library creating xlsx.

I use the fromArray method to populate the MySQL table in xlsx, when I try to populate any cell with accents, the cell fills as "FALSE".

enter image description here

This is my code:

$query="SELECT Caso, Etq_Amarilla, Tipo, Etiqueta, 'EC Sociedad', ProveedorEscalado, Proveedor_de_Mantenimiento, organizativo, OficinaPeople, centro, sociedad, Tipo_Disp, Fecha_y_hora_de_creacion, Fecha_y_hora_de_cierre, domicilio, jcentro04, analitico, DTDT from CdM_Diario where Dia='5'"; $datos=$mysqli->query($query); $objPHPExcel->setActiveSheetIndex(4); $objPHPExcel->getActiveSheet()->fromArray($cabecera,NULL,"A1"); $cont=2; while($fila=$datos->fetch_assoc()) { $objPHPExcel->getActiveSheet()->fromArray($fila,"pepe","A".$cont.""); $cont++; } $cont=2; 

It is decided:

$ mysqli-> set_charset ('utf8');

Thanks Mark Baker

+7
php phpexcel
source share
2 answers

I know that it is quite old, but today I came across this, and utf8_encode($row['field']) worked for me.

+4
source share

PHPExcel works with UTF-8 encoding, you need to use UTF-8 data or convert it before installing it on your object.

  $mysqli->set_charset('utf8'); 

gotta do the trick.

loan for @Mark Baker

+3
source share

All Articles