Can't add row to excel report with xlsx recipe



  • I cant add row with xlsx recipe. Changing sheet name seems to work fine tho

    server.jsreport.render({
        template: {
          recipe: 'xlsx',
          engine: 'handlebars',
          content: fs.readFileSync('./helloWorld.hbs').toString()
          }
        },
        data: data
        }).then((resp) => {
          resp.stream.pipe(fs.createWriteStream(path.join(__dirname, "out.xlsx")));
          res.contentType('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
          res.send(resp.content);
        })
        .catch(err => {
          console.log('ERROR', err);
          res.end(err.message);
        });
    

    my helloWorld.hbs

    {{#xlsxMerge "xl/workbook.xml" "workbook.sheets[0].sheet[0]"}}
       <sheet name="changing sheet name"/>
    {{/xlsxMerge}}
    {{#xlsxAdd "xl/worksheets/sheet1.xml" "worksheet.sheetData[0].row"}}
        <row>
            <c t="inlineStr"><is><t>Hello world</t></is></c>
        </row>
    {{/xlsxAdd}}
    {{{xlsxPrint}}}
    
    

  • administrators

    hi! the code looks good, i don't know what can be the problem so the best will be that you create a small repository with your code so i can check it more deeply, then i can tell you why it was not working


Log in to reply
 

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