TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
dip s
NA
256
82.5k
How to export data table to excel file at 5th row in angular 6
Dec 23 2020 12:17 PM
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.
Reply
Answers (
1
)
Call other component method which is not relatable angular
read and import XML file using angular