How to insert an image in the xsl spreadsheet with php? Since the database is saved only the image path in a folder on the server?

Asked

Viewed 551 times

1

What is being passed to the spreadsheet is only the image path, but I need the image to be passed to the spreadsheet.

The image in the server folder, only the image path is saved to the server.

<?php

    header( "Content-Type: application/vnd.ms-excel" );
    header( "Content-disposition: attachment; filename=relatorio.xls" );

    $sql = "SELECT * FROM tb_manifestacoes";
            $result = mysqli_query($db,$sql);
                while($row=mysqli_fetch_array($result)){
                    echo 'id' . "\t" . 'Row Key' . "\t" . 'Time Stamp' . "\t" . 'Comentários' . "\t" . 'Concessionaria' . "\t" . 'Cpf' . "\t" . 'Data Manifestção' . "\t" . 'Email' . "\t" . 'Imvd' . "\t" . 'Latitude' . "\t" . 'Longitude' . "\t" . 'Nome' . "\t" . 'Reverso' . "\t" . 'Rodovia' . "\t" . 'Status' . "\t" . 'Telefone' . "\t" . 'Tipo de Manifestação' . "\t" . 'Data do Atendimento' . "\t" . 'Cidade' . "\t" . 'AproximadoKm' . "\t" . 'Sentido' . "\t" . "\n";
                    echo $row['id'] . "\t" . $row['rowKey'] . "\t" . $row['timestamp'] . "\t" . $row['comentarios'] . "\t" . $row['concessionaria'] . "\t" . $row['cpf'] . "\t" . $row['datamanif'] . "\t" . $row['email'] . "\t" . $row['imvd'] . "\t" . $row['latitude'] . "\t" . $row['longitude'] . "\t" . $row['nome'] . "\t" . $row['reverso'] . "\t" . $row['rodovia'] . "\t" . $row['status'] . "\t" . $row['telefone'] . "\t" . $row['tipoManifestacao'] . "\t" . $row['dataAtendimento'] . "\t" . $row['cidade'] . "\t" . $row['kmAproximado'] . "\t" . $row['sentido'] . "\t" . $row['imgResposta'] . "\t" . "\n";
                }

?>


header( "Content-Type: application/vnd.ms-excel" );
header( "Content-disposition: attachment; filename=relatorio.xls" );

$sql = "SELECT * FROM tb_manifestacoes";
        $result = mysqli_query($db,$sql);
            while($row=mysqli_fetch_array($result)){
                echo 'id' . "\t" . 'Row Key' . "\t" . 'Time Stamp' . "\t" . 'Comentários' . "\t" . 'Concessionaria' . "\t" . 'Cpf' . "\t" . 'Data Manifestção' . "\t" . 'Email' . "\t" . 'Imvd' . "\t" . 'Latitude' . "\t" . 'Longitude' . "\t" . 'Nome' . "\t" . 'Reverso' . "\t" . 'Rodovia' . "\t" . 'Status' . "\t" . 'Telefone' . "\t" . 'Tipo de Manifestação' . "\t" . 'Data do Atendimento' . "\t" . 'Cidade' . "\t" . 'AproximadoKm' . "\t" . 'Sentido' . "\t" . "\n";
                echo $row['id'] . "\t" . $row['rowKey'] . "\t" . $row['timestamp'] . "\t" . $row['comentarios'] . "\t" . $row['concessionaria'] . "\t" . $row['cpf'] . "\t" . $row['datamanif'] . "\t" . $row['email'] . "\t" . $row['imvd'] . "\t" . $row['latitude'] . "\t" . $row['longitude'] . "\t" . $row['nome'] . "\t" . $row['reverso'] . "\t" . $row['rodovia'] . "\t" . $row['status'] . "\t" . $row['telefone'] . "\t" . $row['tipoManifestacao'] . "\t" . $row['dataAtendimento'] . "\t" . $row['cidade'] . "\t" . $row['kmAproximado'] . "\t" . $row['sentido'] . "\t" . $row['imgResposta'] . "\t" . "\n";
            }
  • I find it easier to use the class Phpexcel. They come with a few examples, including what you need.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.