Add image to excel using HTML-XLSX recipe
-
Is it possible to add an image to excel with the HTML-XLSX recipe or any other recipe? I've attempted to do so in the playground and only the image tag and source show up in the spreadsheet. There is the ability to add an image to a PDF as shown in the 'Invoice pdf' example.
Thanks in advance for any help!
-
Is it possible to add an image to excel with the HTML-XLSX recipe or any other recipe?
unfortunately images are not supported in the
html-to-xlsx
recipe, however you can generate xlsx files with images using the xlsx recipe, it definitely will require more effort but there are more features supported in thexlsx
recipe than thehtml-to-xlsx
recipe, so you will have better luck using it.
-
Thanks for the response bjrmatos. I took a deeper look at the recipes and realized it wasn't the most informed question.
In that case, I'd like to create a custom recipe that is similar to html-to-xlsx recipe but can support images using the helper 'xlsxAddImage'. Is this a possibility or am I going about this in the wrong way? Also, how can I take a look at the recipes that have been created? I see the templates but no way to see the actual recipes that are doing the work.
-
In that case, I'd like to create a custom recipe that is similar to html-to-xlsx recipe but can support images using the helper 'xlsxAddImage'. Is this a possibility or am I going about this in the wrong way?
sure, maybe it is possible.. but instead of creating your custom recipe maybe you can take a look at the source code of the html-to-xlsx recipe, inside that repository you will find that the
jsreport-html-to-xlsx
plugin recipe is using an internal package calledhtml-to-xlsx
, which its source code can be found here, thehtml-to-xlsx
has the core logic of transforminghtml
toxlsx
so maybe you can take a look at the implementation and find a clever way to translate an image from html to the final xlsx file (one way can be to extract the image from the phantomjs engine and serialize it in base64 string and then try to apply that content in the xlsx), and when you finally have the feature implemented you can send us a PR to include it in the official jsreport html-to-xlsx recipe so everybody can enjoy the new feature.Also, how can I take a look at the recipes that have been created? I see the templates but no way to see the actual recipes that are doing the work.
the logic of recipes (and other jsreport plugins) are not show to the end user in jsreport studio, because in general that kind of code is just important for us (the creators/maintainers of jsreport) and plugin authors. however the source code of recipes (and other jsreport plugins) can be found here https://github.com/jsreport, in that github org you can find the repositories of our most used plugins (and other things), which are open source, so you literally can see and inspect every part of jsreport 😀.
-
Thanks again for the detailed responses bjrmatos. The information provided is a huge help in guiding us to a desirable solution!
-
Has this been implemented by any chance? I have just started working with jsreport and trying to add image to the excel, using html-to-xlsx recipe. No luck so far.
-
No, it's still in our backlog https://github.com/jsreport/jsreport/issues/711
You need to use the xlsx recipe for now.