Bellow I have attach my code.
I am trying to print the excel file using angular with out user pressing the ctrl+P. I did found the relevant code in below link and I am able to open the print popup but with just blank white page with no content on it. Thank you for you suggestions in advance.
printListXcel() {
this.listService.getListExcel(this.ListId).subscribe(data => {
const blobData = new Blob([data], {
type:'application/vnd.openxmlformatsofficedocument.spreadsheetml.sheet'});
const blobUrl = URL.createObjectURL(blobData);
const iframexcel = document.createElement('iframe');
iframexcel.style.display = 'none';
iframexcel.src = blobUrl;
document.body.appendChild(iframexcel);
iframexcel.contentWindow.print();
});
}