More

Hi,
I'm able to set CF for some values in the sheet. 

xlObj.XLCFormat.setCFRule({ "action": "textcontains", "inputs": ["U"], "color": "greenft", "range": "B6:AH100" });
xlObj.XLCFormat.setCFRule({ "action": "textcontains", "inputs": ["K"], "color": "redft", "range": "B6:AH100" });
xlObj.XLCFormat.setCFRule({ "action": "textcontains", "inputs": ["F"], "color": "yellowft", "range": "B6:AH100" });

My Problem is that I need more Colors for other conditions then avail in the sheets.cFormatRule.color enum
Is there a way to define other Colors?
Regards Manfred


3 Replies

SP Sangeetha Priya Murugan Syncfusion Team April 9, 2018 09:15 AM UTC

Hi Manfred, 
 
Thank you for using Syncfusion products. 
 
We have checked your reported query and we would like to let you know that, your requirement “To apply custom color for Conditional Formatting” can be achievable by defining your custom colors (Hex color code) to the properties ‘color’ for foreground & ‘bgColor’ for background color in Spreadsheet. Please refer the below code example. 
 
 
CODE EXAMPLE: 
$(function () { 
              $("#Spreadsheet").ejSpreadsheet({ 
                             sheets: [{ 
                                 dataSource: data 
                             }], 
                             loadComplete: "loadComplete", 
              }); 
}); 
function loadComplete(args) { 
              if (!this.isImport) { 
                             // Define Hexa code for font color & background color  in "color" and bgColor property 
                             this.XLCFormat.setCFRule({ "action": "textcontains", "inputs": ["U"], "color": "#FFFFFF", "bgColor": "#1b3ad0", "range": "A1:A11" }); 
                             this.XLCFormat.setCFRule({ "action": "textcontains", "inputs": ["K"], "color": "#FFFFFF", "bgColor": "#139228", "range": "A1:A11" }); 
                             this.XLCFormat.setCFRule({ "action": "textcontains", "inputs": ["F"], "color": "#FFFFFF", "bgColor": "#bd1313", "range": "A1:A11" }); 
              } 
} 
 
Could you please check the above sample and get back to us if you need any further assistance on this? 
 
Regards, 
Sangeethapriya M 



MR Manfred Rohleder April 9, 2018 10:36 AM UTC

Works great.
Thank you very much.

Regards Manfred


SI Silambarasan I Syncfusion Team April 10, 2018 09:06 AM UTC

Hi Manfred, 
 
Thanks for your update. We are happy to hear that your requirement has been achieved. 
Please get back to us if you need any further assistance. 
 
Regards, 
Silambarasan  


Loader.
Up arrow icon