Hi,
I have a data table having employee information (Employee No, Name, Designation) from back end, which I want to show in a report. That report should get exported in excel file. I have written following code in angular 6.
- const ws: XLSX.WorkSheet = XLSX.utils.json_to_sheet(result);
- const wb: XLSX.WorkBook = { Sheets: { 'data': ws }, SheetNames: ['data'] };
- const excelBuffer: any = XLSX.write(wb, { bookType: 'xlsx', type: 'array' });
- this.saveExcelFile(excelBuffer, this.filename);
- saveExcelFile(buffer: any, fileName: string): void {
- const data: Blob = new Blob([buffer], { type: this.fileType });
- saveAs(data, fileName + this.fileExtension);
- }
result is having my data table values. Above code works fine.
It wirtes/exports data table in excel file from1st row.
What I want is,
In excel sheet, I want to merge columns from A1: E1 and I have to show client name there.
Then I want to merge columns from A2:E2 and I have to show client address threre.
Similarly ,I want to show Report name as "Employee Information" in 3rd row of excel sheet.
And from row no 5 in excel sheet ,employee information (data table) should get displayed.
How can I do this?
Any help would be appreiated. Thank you.