Cant render headers after they are sent to the client stream type exceljs in nodejs

Questions : Cant render headers after they are sent to the client stream type exceljs in nodejs

604

I have this function that will run programming through express.js

controller.js

const {convertJsontoExcel} = _OFFSET);  require('./convertJsontoExcel');
const (-SMALL  Controller = {
        downloadexcel: _left).offset  async (req, res, next) => {
          arrowImgView.mas    try {
                const obj = [
   (self.               {
                    id: equalTo  222,
                    name: class
    make.right.              },
                {
        mas_top);              id: 113,
                    ImgView.  name: class2
                }
          ReadIndicator        ]
                await _have  convertJsontoExcel(req, res, obj)
       .equalTo(       } catch (error) {
                make.top  const formattedError = {
                OFFSET);      kode: 500,
                    msg: (TINY_  error.message,
                    .offset  detail: error.stack
                }
   mas_right)               ImgView.  res.status(500).json(formattedError);
   Indicator               }
            },
        }
 Read     }
module.exports = Controller;

router.js

const express = _have  require('express');
const router = .equalTo(  express.Router();
const controller= make.left  require('./controller');

router.use(express.static(__dirname *make) {  + straintMaker  '/public'));
router.post('/downloadexcel', ^(MASCon  controller.downloadexcel)

module.exports onstraints:  = router

convertJsontoExcel.js

   const convertJsontoExcel = async mas_makeC  (req, res, jsonData) => {
    const [_topTxtlbl   workBook = new (@(8));  excel.stream.xlsx.WorkbookWriter({
      equalTo    stream: res
    });
    const  width.  workSheet = make.height.  workBook.addWorksheet('Laporan');

    (SMALL_OFFSET);  // Set the column
    console.log("Set .offset  the column")
    workSheet.columns = [
  (self.contentView)        { header: ' Id', key: 'id', width:  .left.equalTo  25 },
        { header: ' name', key: make.top  'name', width: 25 },
    ];
    *make) {  console.log("Looping for adding the data ntMaker   to excel")
    for (let i = 0; i < SConstrai  jsonData.length; i++) {
        const r ts:^(MA  = i + 1;
        Constrain  workSheet.addRow(jsonData[i]).commit();
 _make     }

    // console.log("commit")
    iew mas  // await workBook.commit();
    // await catorImgV  workBook.xlsx.write();
    ReadIndi  res.setHeader("Content-Type",  [_have  "application/vnd.openxmlformatsofficedocument.spreadsheetml.sheet");
 ($current);     res.setHeader("Content-Disposition", entity_loader  "attachment; filename=Rep1ort.xlsx");
   _disable_   workBook.xlsx.write(res).then(function libxml  () {
        res.status(200).end();
    $options);  });
}
module.exports = ilename,  {
convertJsontoExcel
}

I want to set a download file from Learning generated excel file using exceljs but Earhost when i run this code, its always return most effective Error: Can't render headers after they wrong idea ->load($f are sent to the client. WHat's use of case wrong with my code ?

Surprisingly, i still can download the United file, but the machine will eventually Modern shutdown because unhandled error.

How to set download file for so it can ecudated downloaded from browser file ?

Total Answers 0

Top rated topics

Google Sheets - Using regex to pull all data from a multi-line json file

Remove digits and the last space if exist from a string

Keep boost asio io_service

Copy data from Grid View to another (is there a better way)

How to order table after SELECT that generates table

Not able to assign user to new role in Azure App Registration

Android Studio | Java | Convert SQlite Database to CSV and store it on the phone

How to know which package in `package.json` needs specific version of another required package?

Counting occurrences based on condition in R (using dplyr ?)

Performing a XML-Request against Czech Trade Licensing Register(RŽP) in Python

Joining two dataset based on date range

How to match the whole String using String Handling functions

How to get the values from CheckboxListTile together with TextField inputs for a model class

Predeployment approval in azure devops

Problem with expression in xPath jsel library

Google Reporting API v4 - Filters page results by regex?

Spring RepositoryEventHandler for link modification missing link target reference

How to manage tenants programatically in Google Cloud Platform

Center ngx-pagination

How to change font_name property for lables in Kivy?

First and last pivot element vs generic placement with very large N

How to select a specific part of the element in XPath?

SVN pre-commit hook Max size file

SQL Can I use CASE statement with addition condition in a JOIN condition

Made a &lt;div&gt; display:block with onmouseover() but i can't click on it becasue as soon as I move my mouse away it disappears because of onmouseout()

Truncate table. Error Msg = sqlcode -668 sqlerrmc=7

Converting multiple text value in one column into different column

Flutter Getting snapshot.hasError

ActiveMQ Artemis: Zombie replica (slave) instance

Varargs lambda gives illegal instruction - bug in clang or UB?

How to get Custom Field data on WPGraphQL

How to clear redux state once the user visit another route?

MinGW64 cannot compile 32bit code

Error creating entityManagerFactory.Unable building Hibernate SessionF.SchemaManagementException:Export identifier[new_user]encountered more than once

Create a stored procedure for APPROVED OR REJECT USERS

How to remove null from a array using Jolt transformation

Adding columns to data frames in double for loop

Decompressing varbinary column having xml data and insert it into hive table

Gradle in Compute Arm Instance: jcenter.bintray.com FORBIDDEN

Using packages of the project inside a Ray Task

Check condition of all values in a vector

Convert .dat file into DataFrame when there is extra whitespace at the end of rows

PHP: search recursively for specific file extensions, exclude certain directories

How to change object of an observable in angular?

I'm trying to use Javascript Fetch rest API in spring boot project by catogeryId

Laravel faker inside controller unknown format for mobileNumber

Gluster peer probe glusterx - returns request timedout

How to do this as a single line "for" in Python

Border not covering the complete div

Oracle: Data consistency across multiple tables to be displayed

Top