rainabba / jquery-table2excel

jQuery Plugin to export HTML tabled to Excel Spreadsheet Compatible Files
593 stars 666 forks source link

Image doesn't appear in Excel file #45

Open podisto opened 8 years ago

podisto commented 8 years ago

Hi, i use this amazing library in my Symfony project. All data is reported excepted images. Here is what i do:

<table class="table table2excel">
            <thead>
            <tr>
                <th>
                    <img src="{{ asset('img/button_cancel.png') }}" alt="btn">
                </th>
                <th>Nom</th>
                <th>Prenom</th>
                <th>Age</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>1</td>
                <td>{{ name }}</td>
                <td>Omar</td>
                <td>40</td>
            </tr>
            <tr>
                <td>1</td>
                <td>{{ name }}</td>
                <td>Iba</td>
                <td>24</td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <td colspan="4">
                    <a href="#" class="exportBtn"><img src="{{ asset('img/icons/excel48.png') }}"></a>
                </td>
            </tr>
            </tfoot>
        </table>

And the JS code :

$(function () {
    $(".exportBtn").click(function() {
        var current = new Date();
        $(".table2excel").table2excel({
            // Exclude CSS class
            exclude: ".noExl",
            exclude_img: false,
            file_ext: ".xls",
            name: "test",
            filename: "export" + current.getSeconds()
            // Do not include extension
        });
    });
});

The button cancel image doesn't appear.

rdmordido commented 6 years ago

Same issue here. Did you get this solved? @podisto

lcruz8 commented 3 years ago

I Have the same problem, did anyone get this solve?

rainabba commented 3 years ago

Feel free to submit a PR to add the functionality. The next best thing would be a link to documentation on how we would embed an image into an XML file in a way that Excel will open and use that image.