Export HTML Table Image to EXCEL or PDF

0

I have an HTML table, in the last column an image is displayed (JPEG, PNG). Is it possible to export this table to EXCEL or PDF with the image? I used DataTables to do a test, but the image is not exported together with the table.

<!DOCTYPE html>
<html>
<head>
	<title>Export DataTable</title>
	<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap.css">
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css">
	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.1/css/buttons.bootstrap4.min.css">
    
</head>
<body>
<table id="example" class="table table-striped table-bordered" style="width:80%; margin: 10px auto;">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
                <th>Age</th>
                <th>Start date</th>
                <th>Salary</th>
                <th>Imagem</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>Tiger Nixon</td>
                <td>System Architect</td>
                <td>Edinburgh</td>
                <td>61</td>
                <td>2011/04/25</td>
                <td>$320,800</td>
                <td><img src="https://www.supercarros.cc/uploads/default/files/unidade/3/foz_img_1.jpg"height="100px"></td>
            </tr>
            <tr>
                <td>Garrett Winters</td>
                <td>Accountant</td>
                <td>Tokyo</td>
                <td>63</td>
                <td>2011/07/25</td>
                <td>$170,750</td>
                <td><img src="http://www.imagenswiki.com/Uploads/imagenswiki.com/ImagensGrandes/imagens-motos-honda.jpg"height="100px"></td>
            </tr>
            <tr>
                <td>Ashton Cox</td>
                <td>Junior Technical Author</td>
                <td>San Francisco</td>
                <td>66</td>
                <td>2009/01/12</td>
                <td>$86,000</td>
                <td><img src="http://fotos.jornaldocarro.estadao.com.br/uploads/2017/09/30172748/Hennessey-Venom_GT-2011-1280-05-1160x709.jpg"height="100px"></td>

            </tr>
        </tbody>
    </table>

    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.bootstrap4.min.js"></script><scripttype="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script><scripttype="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script><scripttype="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.html5.min.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js"></script><scripttype="text/javascript" src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.colVis.min.js"></script><scripttype="text/javascript">
    	
    	$(document).ready(function() {
    		var table = $('#example').DataTable( {
    			lengthChange: false,
    			buttons: [ 'copy', 'excel', 'pdf']
    		} );

    		table.buttons().container()
    		.appendTo( '#example_wrapper .col-md-6:eq(0)' );
    	} );

    </script>

</body>
</html>
    
asked by anonymous 26.03.2018 / 15:39

0 answers