Assuming your JSON data will be something like what assigned to readyToExport and hence it is shown how to export your JSON data.public export() {const readyToExport = [ {id: 1, name: 'a', address: 'x'}, {id: 2, name: 'b', address: 'y'}, {id: 3, name: 'c', address: 'z'}];const workBook = XLSX.utils.book_new(); // create a new blank bookconst workSheet = XLSX.utils.json_to_sheet(readyToExport);XLSX.utils.book_append_sheet(workBook, workSheet, 'data'); // add the worksheet to the bookXLSX.writeFile(workBook, 'temp.xlsx'); // initiate a file download in browser} 这篇关于如何使用angular 2将我的json数据导出为pdf,excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-29 12:21
查看更多