Rendering html string in docx template.



  • Hi, I am using jsreportonline and I am trying to render a string value that has html tag embedded inside in a docx template. My engine is handlebars and i thought using the triple brackets({{{}}}) would do the trick but that is not working. I went through a couple of previous posts where some people were having the same issue and it seem like html-docx-js is the recommended solution. Since this recipe is missing in jsreportonline how do I install it? Do I need to create a project locally and import that in jsreportonline? I couldn't find anything in the docs either. Any help is appreciated.

    Thank you!



  • Unfortunately, the docx recipe doesn't support embedding html yet.
    I have submitted an issue to our backlog so you can track when it gets implemented https://github.com/jsreport/jsreport/issues/683

    jsreportonline doesn't support running custom npm modules, you need to spin up your own jsreport on prem instance if you want to go this way.
    https://jsreport.net/learn/online-faq#dedicated-on-prem-vs-jsreportonline

    The docxtemplater custom recipe support a simple html docx embedding in the docxtemplater paid version as far as I know. Although not part of jsreportonline.



  • Hi,

    Thank you for the response. Is it possible to use html-embedded-in-docx recipe on jsreportonline or do I have to spin up my own jsreport instance for that because I saw a playground example(https://playground.jsreport.net/w/admin/UwTKeBUW) that was using this recipe but I couldn't find it in my recipe list on jsreportonline.

    Thanks!



  • You can get to the jsreportonline pre-installed through the about modal.
    However, if you don't see the recipe in the menu, it isn't installed in jsreportonline.
    So, unfortunately, yes, you need to spin up your own instance to have this one.

    Please note html-embedded-in-docx makes it very easy to embed html and the output can be opened in the ms word but it won't work for example in the Open Office.



  • Hi Jan,

    I have been playing around with the html-embedded-in-docx and since it was not available in the jsreportonline I spinned up my own instance and installed the module. I am using jsreport version 2.6.1 and I could see the docx generated in the preview panel with all the html strings embedded correctly but when I am trying to generate the file through the api, the docx file is coming up empty. I could see that the raw source code, and it has all the tag embedded inside but when I am converting that stream of data to a docx file it is coming up empty. I am also attaching an image from my REST api client so you could see what the data looks like. Any help it appreciated. Thank you!



  • What if you use "Download" button from the "Run" button context menu? Do you get back valid docx?

    Maybe you wrongly process the response stream?
    What if you call a pdf recipe? Are you able to save the response and process it?
    What you have inside the options?



  • Thank you for much for the quick response!
    When I click the 'download' button it does spit out a valid docx file but that file is also empty. I tried with a different recipe(like chrome-pdf) with the same api and that is working so the issue right now is only when I use the recipe html-embedded-in-docx. options currently have only the reportName . I have also tested using the playground api and it's the same issue. docx file is always empty



  • For me, it works with the linked playground demo.
    Do you open it in full MS Word?
    As I noted, it won't work in openoffice or such apps.



  • Let me test it with the MS word.



  • I apologize for the confusion. It is indeed working with the MS Word. Thank you so much for the help. I really appreciate it.


Log in to reply
 

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