How to add image to excel report?



  • I have "html-to-xlsx" report with "handlebars" engine from one of default examples(sales-main).
    Body code looks something like

    <table name="Sales-Detail">
      <tbody class="head">
        <tr>
          <td>
            <img src="{{{base64image}}}" class="some-class" />
          </td>
        </tr>
     <!-- The rest of the code -->
    </table>
    

    May you have any ideas what went wrong? Everything else if working fine, but I keep having white space instead of image



  • html-to-xlsx recipe doesn't support images.
    We have this feature in the backlog if you want to upvote it or follow it.
    https://github.com/jsreport/jsreport/issues/711

    You need to use the xlsx recipe until it gets implemented.



  • Hi @jan_blaha,

    I saw the older note that jsreport html-to-xlsx recipe didn’t support images (issue #711) and that it was in the backlog.

    Can you please confirm if html-to-xlsx supports images now (for example <img src="data:image/png;base64,..."> or external image URLs)?
    If not, is there any recommended workaround besides switching to the xlsx recipe?

    Thanks in advance.



  • Hi @Ish-Modi

    It will be part of the next release 4.12.0 which should be live within two weeks.



  • Hi @jan_blaha,

    I noticed that jsreport released v4.12.0; congratulations!

    Can you please provide guidance on how to use html-to-xlsx with image support?

    Thanks in advance.


  • administrators

    @Ish-Modi the usage is exactly as the code snippet in this thread.

    <table>
    <tr>
          <td>
            <img src="{{base64imageDataUri}}" />
          </td>
        </tr>
    </table>
    

    to generate the base64 data uri you can use assets


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.