Tuesday 2 January 2024

file Saver at UI - Angular convert JSON response to excel file to download.

file Saver - UI Angular

==========================


ng.component.ts

----------------


import * as fileSaver from 'file-saver';


  downloadTestExcelFile() {

    const data = "Excel File column to get Default column name;

    const blob = new Blob([data], {type: 'text/csv'});

    fileSaver.saveAs(blob, "Downloaded_Custom_file_name");

  }

  

  

  

  

  

ng.template.html

------------------

<a href="javascript:void(0)" id="downloadTestExcel_id" (click)="downloadTestExcelFile()" class="link">Click here to download FileSaver    Test File</a>

No comments:

Post a Comment

React + Typescript_ Module federation _ Micro Front end -Standalone and integrated

Module Federation The Module Federation is actually part of Webpack config. This config enables us to expose or receive different parts of t...