on ‎2020 Jul 01 3:44 AM
Hi Experts,
Is it possible to configure the columns to show the following result using spreadsheet in SAPUI5?
If yes, kindly let us know the sample/reference. Thanks.
To export excel, I refered this link. But, it is just one line header and no merge cells.

Best Regards,
Thiri
Request clarification before answering.
Hi all,
I can export the above file format (merged cells in exported excel file) using third-party library 'XLSX.js'.
1. Download the library file from the link : https://github.com/SheetJS/sheetjs
2. Add this library file to your project.
3. Declare the library in your controller.
4. Configure the following code in your controller.
var data = [ *set your data here* ]
/* generate worksheet */
var ws = XLSX.utils.aoa_to_sheet(data);
/* merged cells settings */
var mergedCells = { s: {r: 0, c: 1}, e: {r: 0, c: 2}};
if (!ws["!merges"]) ws["!merges"] = [];
ws["!merges"].push(mergedCells);
/* generate workbook */
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "sheet1");
XLSX.writeFile(wb, "test.xlsx");
Best Regards,
Thiri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Thiri,
Yyou can use class sap.ui.export.Spreadsheet to set up a lot of things in a custom export to excell button of yours, but if I understood correctly, as explained in this, grouping headers is not possible.
Regards,
Felipe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 8 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.