How to render api `Excel, PDF and Html` on `Meteor + Vue`?



  • I abse on Meteor + Vue.
    I don't understand render report api such as excel, pdf, html
    My code:

    • Vue Template
    <template>
      <div>
        <p>
          <el-button @click="getReport">Get Report</el-button>
        </p>
    
        <div>
        {{ reportRender }}
        </div>
      </div>
    </template>
    --------
    methods: {
        getReport() {
          axios
            .get('/api/jsreport')
            .then(function(response) {
              this.reportRender = response
            })
            .catch(function(error) {
              console.log(error)
            })
        },
      },
    
    • Server
    import { WebApp } from 'meteor/webapp'
    import express from 'express'
    import request from 'request'
    const appEx = express()
    
    appEx.get('/api/jsreport', (req, res) => {
      let body = {
        template: {
          shortid: 'SJtztNP4Q',
          recipe: 'chrome-pdf',
        },
        options: {
          'Content-Disposition': 'attachment; filename=myreport.pdf',
        },
      }
      let options = {
        uri: 'http://localhost:5488/api/report',
        method: 'POST',
        json: body,
      }
    
      request(options).pipe(res)
    })
    
    WebApp.connectHandlers.use(appEx)
    

    Please help me



  • Now work find for HTML and PDF when i used

    jsreport-browser-client-dist
    

    But don't work with Excel View


  • administrators

    hi! i think browser doesn't handle excel output by default (in the same way that handles html and pdf) so i think it is expected that normal rendering of excel does not work there by default, i think it needs more code to be able to handle the excel response in the browser. we will try to find the time to prepare an example for this, we will post the updates here in your github issue.



  • Thanks for your reply, waiting you...



  • Excuse me @bjrmatos, could you example the embed Excel render on iframe/web component?
    I do need this option


Log in to reply
 

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