How to add multiple table with different data-set to the same sheet in exceljs

▼魔方 西西 提交于 2019-12-08 02:45:26

问题


I have a button to export a excel file with the data(JSON format). I can able to do for one table but I want to have multiple tables(different datasset-JSON) in the same excel sheet and export that file as shown below.

I'm using exceljs and file-saver with angular2 in node environment. please guide me with the right approach. Thanks in advance.


回答1:


I had a similar question and got the answer to it - Angular xlsx - multiple json to sheet

Your case is a bit different as you need to play around with merging cells, but there is the option to create the second json with empty props like:

let obj = { Name: 'Johnson', '': '', Age: 32, '', '' } 

Not pretty and not ideal as it will only fit the format of the columns. However there are few ideas on the web for merges - https://github.com/SheetJS/js-xlsx/issues/416

Hope this helps.



来源:https://stackoverflow.com/questions/52851598/how-to-add-multiple-table-with-different-data-set-to-the-same-sheet-in-exceljs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!