Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

186
Visualizações
Rendering html-to-xlsx recipe response from JSReport into a downloadable excel sheet

I have patient data in my databases represented in HTML that I want to print as an excel sheet using JSReport. But when I get the response from the jsreport server with the recipe it reads jibberish and I can't find a way to render it into an excel file.

Dummy example

const axios = require("axios");

const url = "http://localhost:5488/api/report/";

const data = {
  "template": {
      "shortid": "2_Kw0BRuOm",
      "recipe": "html-to-xlsx",
      "data": {
          "people": [
              {
                  "name": "Omar rafat",
                  "age": "20",
                  "job": "Software Engineer"
              }
          ]
      }
  }
}

axios.post(url, {
  "template": {
      "shortid": "2_Kw0BRuOm",
      "recipe": "html-to-xlsx",
      "data": {
          "people": [
              {
                  "name": "Omar rafat",
                  "age": "20",
                  "job": "Software Engineer"
              }
          ]
      },
      "options": { "reports": { "save": true } }
  }
}).then(res => console.log(res.data)).catch(err => console.log(err));

Raw html-to-xlsx response

enter image description here

I might have missed up on the library's usage due to my misunderstanding of how the technology works but I really hope some of you might guide me on the correct implementation of it.

Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

jsreport has nodejs client you can use https://jsreport.net/learn/nodejs-client

You can check the following example on how to render a template and store the output to the file.

const client = require('jsreport-client')('http://localhost:5488')
const fs = require('fs').promises


async function render () {
  const res = await client.render({
    template: { shortid: '2_Kw0BRuOm' },
    data: { someText: 'world!!' }
  })

  const responseBuffer = await res.body()
  await fs.writeFile('out.xlsx', responseBuffer)
}

render().catch(console.error)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda