Conditional format

Technical support for Spire.XLS

Moderators: iceblue support, Flash, Manager

Conditional format

Postby mzahumensky » Fri Jan 11, 2013 3:37 pm

Is it possible to get some sample with conditional formating in Excel?
Thanks
Martin
mzahumensky
 
Posts: 18
Joined: Fri May 20, 2011 11:29 am

Re: Conditional format

Postby mzahumensky » Fri Jan 11, 2013 5:24 pm

I made some simple condition in VB, maybe it helps to someone else. I hope it is correct.

Code: Select all
oBook = New Workbook()
oSheet = oBook.Worksheets(0)

Dim objCond As Spire.Xls.ConditionalFormatWrapper
objCond = oSheet.Range(3, 3).ConditionalFormats.AddCondition()
objCond.FormatType = ConditionalFormatType.Formula
objCond.FirstFormula = "=$C$3 > $A$3 + $B$3"
objCond.Operator = ComparisonOperatorType.Greater
objCond.BackColor = Color.Red

oSheet.Range(3, 1).NumberValue = 2
oSheet.Range(3, 2).NumberValue = 4
oSheet.Range(3, 3).NumberValue = 7
oBook.CalculateAllValue()
mzahumensky
 
Posts: 18
Joined: Fri May 20, 2011 11:29 am

Re: Conditional format

Postby amy.zhao » Mon Jan 14, 2013 7:17 am

Hello Martin,

Thank you for sharing.
Your code will work well. It will very useful.

Best regards,
Amy
E-iceblue support team
User avatar
amy.zhao
 
Posts: 2251
Joined: Wed Jun 27, 2012 8:50 am


Return to Spire.XLS

Who is online

Users browsing this forum: No registered users and 2 guests