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

supportScreen1.JPG

Screen 2

supportScreen2.JPG

Screen 3


3 Replies 1 reply marked as answer

AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team January 30, 2024 03:53 PM UTC

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.


Sample: https://stackblitz.com/edit/angular-z3org2-1cvzuy?file=src%2Fapp.component.html,src%2Fapp.component.ts


Please let us know if you have any concerns.


Regards,

Angelin Faith Sheeba.


Marked as answer

ZB Zietse Boonen | Castars January 30, 2024 04:29 PM UTC

Dear Support

This solved my issue perfectly thank you for the assist !


Regards,

Zietse Boonen

Dev@Castars



AP AngelinFaithSheeba PaulvannanRajadurai Syncfusion Team January 31, 2024 07:47 AM UTC

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.


Loader.
Up arrow icon