问题
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