We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

ConditionalFormats

Hi,
how can i use collection ConditionalFormats? I would like to set Conditional Formating (Color Scale from red to green) to one column (with numbers). How can i do that? Can somebody help me?


3 Replies

YG Yavanaarasi G Syncfusion Team August 21, 2008 07:20 AM UTC

Hi Michal,

Thank you for your interest in Syncfusion products.

You can use collection of ConditionalFormats by using IConditionalFormats interface. If you want to change the color from red to green with the numbers you can set the condition like below:


[C#]
sheet.Range["E1:E20"].CellStyle.ColorIndex = ExcelKnownColors.Red;

//Applying conditional formatting to "E1 to E20" for format type as CellValue( Between)

IConditionalFormats condition = sheet.Range["E1:E20"].ConditionalFormats;
IConditionalFormat condition1 = condition.AddCondition();

//Set the condition
condition1.FirstFormula = "10";
condition1.SecondFormula = "20";

//Setting format properties.
condition1.Operator = ExcelComparisonOperator.Between;
condition1.FormatType = ExcelCFType.CellValue;
condition1.BackColorRGB = Color.FromArgb(0, 100,0);


Here is the sample for your reference:
http://www.syncfusion.com/development/uploads/XlsIO_ConditionalFormatting_be69897b.zip

Also please refer our shipped browser sample that demonstrates how conditional formatting can be applied with Essential XlsIO.

\Syncfusion\EssentialStudio\6.3.0.30\Windows\XlsIO.Windows\Samples\2.0\Formatting\ConditionalFormatting\CS

Please try this and let me know if this helps.

Regards,
G.Yavana



AD Administrator Syncfusion Team August 21, 2008 08:00 AM UTC

Thank you for you reply, but it isn't exactly type of formating which i would like. I'd like color SCALE from green to red. An exmaple is attached.

Thanks,
Michal



Book1_923b2467.zip


YG Yavanaarasi G Syncfusion Team August 21, 2008 10:12 AM UTC

Hi Michal,

Thank you for providing the file.

Currently we do not provide support for this feature in our code library. Already we have logged a feature request [#3072] regarding this. It will be expected to be available in our next release. We will update you once the feature has been implemented.

Please let me know if you have any other concerns.

Regards,
G.Yavana


Loader.
Live Chat Icon For mobile
Up arrow icon