- Home
- Forum
- Angular - EJ 2
- Conditional formatting style also applied on Excel export
Conditional formatting style also applied on Excel export
Dear Support
I have a question. I have some code for conditional formatting that if something is negative to display it red in my pivot view (see screenshot1.). The problem is when I use the Excel export (see screenshot 2.) the style that I put in the conditional formatting is also imported into the export (see screenshot 3.) of the excel and I don't want that. Is there a way to avoid this?
Thank you in advance !
Greetings
Zietse Boonen
Dev @ Castars
Screen 1
Screen 2
Screen 3
Hi Zietse,
We would like to inform you that if the conditional formatting is applied, pivot table will be exported with the formatted value cells. This is the default behavior in our pivot table. However, using excelQueryCellInfo event, you can able to restrict the conditional formatting styles for specific pivot table cells before exporting to an Excel document based on your need. Please refer the below code example.
Code Example:
|
this.gridSettings = { excelQueryCellInfo: this.observable.subscribe(args => { if ((args as any).style.fontColor && (args as any).style.fontSize && (args as any).style.fontName) { (args as any).style.fontColor = '#000000'; (args as any).style.fontSize = 10; (args as any).style.fontName = 'unset'; } }) as any } as GridSettings;
document.getElementById('export').onclick = () => { this.pivotObj.excelExport(); }; |
Output screenshot:
Pivot table:
Excel Document:
Meanwhile, we have prepared a sample for your reference.
Please let us know if you have any concerns.
Regards,
Angelin Faith Sheeba.
Dear Support
This solved my issue perfectly thank you for the assist !
Regards,
Zietse Boonen
Dev@Castars
Hi Zietse,
Thanks for the update. Please contact us if you have any other queries. We are always happy to assist you.
Regards,
Angelin Faith Sheeba.
- 3 Replies
- 2 Participants
- Marked answer
-
ZB Zietse Boonen | Castars
- Jan 29, 2024 04:23 PM UTC
- Jan 31, 2024 07:47 AM UTC