Hi guys! I have added green color to my cells.
cell.addClass('light-green');
But when I want to export my report to xslx file I dont see these colors. (screen 3, 4)
I've checked this example https://jsfiddle.net/flexmonster/v06jx81y/ and I also see that not all colors displaying (screens 1, 2) in xlsx file
Could you help me with this issue?
Hello, Denis,
Thank you for your question.
Our team wants to explain that styles added by customizeCell
hook are ignored while exporting to Excel.
Part of the cells is colored when exporting from the mentioned example because they are styled using CSS. In its turn, the customizeCell
API call itself does not affect styling.
Please consider using the conditional formatting feature instead of the customizeCell
method.
In case you need more general styling, it is possible to use built-in CSS themes/creating your own one.
Both approaches allow preserving formatting after exporting to Excel.
We hope it helps.
Please contact us in case other questions arise.
Kind regards,
Illia
I see, tnx a lot. Just have one question: how works this example with bg-color https://jsfiddle.net/flexmonster/v06jx81y/, some cells are colored with cell.addClass, some not in exported xlsx file, but if I'll delete this code cell.addClass("fm-level-"+data.level); and try to export xlsx file all cells will be without colors? Is it mean that cell.addClass("fm-level-"+data.level) still affects on some cells?
Hello, Denis,
Thank you for your feedback.
We want to notice that removing the cell.addClass("fm-level-" + data.level)
code snippet does not affect the exported Excel file. Some cells are still colored because their styling is defined directly in the CSS.
We hope it helps.
Please contact us in case any other questions arise.
Best regards,
Illia
Understood. Thank you!