Generating a spreadsheet with PHP does not appear the same in Open Calc as in Excel

0

I have a problem with generating a spreadsheet with PHP, the problem in particular when generating it if I open it with Open Cal it opens in the correct way, but with excel it is different since it does not include the accents and it is not for the UTF-8 I have the following code.

so that it generates me it has to collect certain data and I have the following code

<?php
include ('includes/sesion.inc.php');
include ('includes/excelwriter.inc.php');

// var_dump(error_reporting(E_ALL));

$equipos_pruebas=lista_pru_lejarreta_equipos('', $conn);
$integrantes_equipo=lista_pru_lejarreta_miembros('',$conn);


for ($i=0; $i <$equipos_pruebas['count']; $i++) {

    if($_GET['id_edicion']==$equipos_pruebas[$i]['id_edicion']){

        for ($j=0; $j < $integrantes_equipo['count']; $j++) {


            if($equipos_pruebas[$i]['id'] == $integrantes_equipo[$j]['id_equipo']){

                $lista_equipo []= array(
                    'equipo' => $equipos_pruebas[$i]['nombre'],
                    'categoria'=> $equipos_pruebas[$i]['categoria'],
                    'responsable' => $equipos_pruebas[$i]['responsable'],
                    'telefono' => $equipos_pruebas[$i]['telefono'],
                    'conductor' => $equipos_pruebas[$i]['conductor'],
                    'matricula' => $equipos_pruebas[$i]['matricula'],
                    'acompanantes' => $equipos_pruebas[$i]['acompanantes'],
                    'importe' => $equipos_pruebas[$i]['importe'],
                    'numero_integrante' => $integrantes_equipo[$j]['numero'],
                    'nombre_integrante' => $integrantes_equipo[$j]['nombre'],
                    'dni_integrante' => $integrantes_equipo[$j]['dni'],
                    'fecha_nacimiento' => $integrantes_equipo[$j]['fecha_nacimiento'],
                    'licencia' => $integrantes_equipo[$j]['licencia']

                );

            }

        }

    }

}
lista_equipos_lejarreta_excel($_GET['carrera'],$lista_equipo);

that function is here is what generates the spreadsheet with the data:

    <?php

function lista_equipos_lejarreta_excel($nombre,$datos){

    $excel=new ExcelWriter("../ficheros/equipos_carrera_".$nombre.".xls");
    $titutos = array(utf8_decode("<strong>Equipo</strong>"),
                    utf8_decode("<strong>Categoría</strong>"),
                    utf8_decode("<strong>Responsable</strong>"),
                    utf8_decode("<strong>Teléfono</strong>"),
                    utf8_decode("<strong>Conductor</strong>"),
                    utf8_decode("<strong>Matrícula </strong>"),
                    utf8_decode("<strong>Acompañantes</strong>"),
                    utf8_decode("<strong>Importe</strong>"),
                    utf8_decode("<strong>Número Integrante</strong>"),
                    utf8_decode("<strong>Nombre</strong>"),
                    utf8_decode("<strong>Dni</strong>"),
                    utf8_decode("<strong>Fecha Nacimiento</strong>"),
                    utf8_decode("<strong>Licencia</strong>")
                );
    $excel->writeLine($titutos);

    for ($i=0; $i < count($datos); $i++) {

        $dato_temp[1]=utf8_decode($datos[$i]['equipo']);
        $dato_temp[2]=utf8_decode($datos[$i]['categoria']);
        $dato_temp[3]=utf8_decode($datos[$i]['responsable']);
        $dato_temp[4]=$datos[$i]['telefono'];
        $dato_temp[5]=utf8_decode($datos[$i]['conductor']);
        $dato_temp[6]=$datos[$i]['matricula'];
        $dato_temp[7]=$datos[$i]['acompanantes'];
        $dato_temp[8]=$datos[$i]['importe'];
        $dato_temp[9]=$datos[$i]['numero_integrante'];
        $dato_temp[10]=utf8_decode($datos[$i]['nombre_integrante']);
        $dato_temp[11]=$datos[$i]['dni_integrante'];
        $dato_temp[12]=$datos[$i]['fecha_nacimiento'];
        $dato_temp[13]=$datos[$i]['licencia'];

        $excel->writeLine($dato_temp);
    }


    header('location:../ficheros/equipos_carrera_'.$nombre.'.xls');
}

I have previously worked on generating excel but in a totally different case, but this is something curious to see since I go back and repeat in Open Calc it looks great but in Excel someone could help me? I've been with this for several days and it's for work, I work with a little known framework called smarty so if they see something weird that's why haha.

Greetings to all and thanks in advance:)

    
asked by juank 14.09.2018 в 11:29
source

0 answers