Javascript JSON to Excel file download

前端 未结 6 2061
情书的邮戳
情书的邮戳 2020-12-31 18:14

I have Json data and i need convert json data to Excel file using javascript,

Reference URL : http://jsfiddle.net/hybrid13i/JXrwM/

i am using this code:

6条回答
  •  礼貌的吻别
    2020-12-31 18:50

    I know its a little late to answer but I have found an nice angular library that does all the hard work it self.

    GITHUB: ngJsonExportExcel

    Library Direct Download : Download

    Filesaver JS : Download

    How to use?

    1. Include the module in you app

    var myapp = angular.module('myapp', ['ngJsonExportExcel'])

    1. Add a export button and use the ng-json-export-excel directive and pass data into the directive

    ng-json-export-excel : it is the directive name

    data : it is the data that will be exported (JSON)

    report-fields :

    pass the column name and the keys that are present in your JSON e.g. customer_name": "Customer Name"

    HTML

    
    

提交回复
热议问题