Articles in this section
Category / Section

How to set conditional formatting for numbers?

1 min read

Use the following code snippets to set conditional formatting for numbers.

C#

// Applying conditional formatting to "A3" for format type as CellValue (Equal)
IConditionalFormats condition2 = sheet.Range["A3"].ConditionalFormats;
// Adding formats to IConditionalFormats collection
IConditionalFormat condition3 = condition2.AddCondition();
sheet.Range["A3"].Text = "Enter the Number as 1000";
// Setting format properties.
condition3.FormatType = ExcelCFType.CellValue;
condition3.Operator = ExcelComparisonOperator.Equal;
condition3.FirstFormula = "1000";
condition3.FontColorRGB = Color.FromArgb(0xDE, 0x64, 0x13);

VB

' Applying conditional formatting to "A3" for format type as CellValue (Equal)
Dim condition2 As IConditionalFormats = sheet.Range("A3").ConditionalFormats
' Adding formats to IConditionalFormats collection
Dim condition3 As IConditionalFormat = condition2.AddCondition()
sheet.Range("A3").Text = "Enter the Number as 1000"
' Setting format properties.
condition3.FormatType = ExcelCFType.CellValue
condition3.Operator = ExcelComparisonOperator.Equal
condition3.FirstFormula = "1000"
condition3.FontColorRGB = Color.FromArgb(204, 212, 230)

Take a moment to peruse the documentation, where you can find basic worksheet data manipulation options along with features like Conditional Formatting, worksheet calculations through formulas, adding charts in worksheets or workbooks, organizing and analyzing data through tables and pivot tables, appending multiple records to a worksheet using template markers, and most importantly, PDF and image conversions, etc., with code examples.

Refer here to explore the rich set of Syncfusion Essential XlsIO features.

 

Note:

Starting with v16.2.0.x, if you reference Syncfusion assemblies from the trial setup or from the NuGet feed, include a license key in your projects. Refer to this link to learn about generating and registering a Syncfusion license key in your application to use the components without a trial message.

 

Conclusion:

I hope you enjoyed learning about how to set conditional formatting for numbers in XlsIO.

 

You can refer to our XlsIO’s feature tour page to learn about its other groundbreaking features. Explore our UG documentation and online demos to understand how to manipulate data in Excel documents.

If you are an existing user, you can access our latest components from the License and Downloads page. For new users, you can try our 30-day free trial to check out XlsIO and other Syncfusion components.

If you have any queries or require clarification, please let us know in the comments below or contact us through our support forums or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied