Getting Html Documents instead of docx when calling proxy.render on docx Template



  • When I call to render a docx Template from a Script instead of the actual docx Document I get a Html as return value whit a link to the Word Preview on Microsoft Office Online service(?)
    How can I change that to get the actual docx document?

    const jsreport = require('jsreport-proxy')
    
    async function afterRender(req, res) {
        // do some stuff before
        let options =  {
            "reports": {
                "save": true
            },
        }
            const rendered = await jsreport.render({
                template: {
                    name: 'myDocxTemplate'
                }, data: data, options: options
            })
           //do some stuff after 
    

    Response Html:

    <html><head><title>myDocxTemplate</title><body><iframe style="height:100%;width:100%" src="https://view.officeapps.live.com/op/view.aspx?src=http%3A%2F%2Fjsreport.net%2Ftemp%someCripticId.docx" /></body></html>

  • administrators

    hi @Marsturix when you run from studio the render request executes always on preview mode so the results of the render give you the preview mode of the docx. when you render from the http api you should get the normal docx and not the iframe preview version

    I think if you want to force to not use the preview mode when you run from the studio then you can pass in the options

    let options =  {
            "preview": false,
            "reports": {
                "save": true
            },
        }
    

Log in to reply
 

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