IConditionalFormat problemes

Posted by: ytheaudin on 8 September 2017, 1:52 pm EST

  • Posted 8 September 2017, 1:52 pm EST


     Hi,


     I do not understand, setconditionnalformat not function on the column of fiter?


    Dim styleHot As New FarPoint.Win.Spread.NamedStyle


    styleHot.ForeColor = Color.Red


    styleHot.Locked = True


    If TypeOf FpSpread2_Sheet1.Models.Style Is FarPoint.Win.Spread.IConditionalFormatSupport Then


    FpSpread2_Sheet1.SetConditionalFormat(-1, FpSpread2_Sheet1.Columns("Lock").Index, styleHot, FarPoint.Win.Spread.ComparisonOperator.NotEqualTo, "T("""")")


    End If


    best regards


    2009/05/Capturer.JPG
  • Replied 8 September 2017, 1:52 pm EST

    Hi


    I want to apply a style to a line condition

     

    thanks

     

    Yvan TEHAUDIN
  • Replied 8 September 2017, 1:52 pm EST

    Hello,

    I am not clear with the requirement "setconditionnalformat not function on the column of fiter". As far as SetConditionalFormat function is concerned it sets conditional formatting for a specified cell on the sheet based on a specified
    comparison. E.g the below in the below snippet

    Dim styleCold As New FarPoint.Win.Spread.NamedStyle
    Dim styleCool As New FarPoint.Win.Spread.NamedStyle
    Dim styleMild As New FarPoint.Win.Spread.NamedStyle
    Dim styleWarm As New FarPoint.Win.Spread.NamedStyle
    Dim styleHot As New FarPoint.Win.Spread.NamedStyle
    styleCold.BackColor = Color.Blue
    styleCold.ForeColor = Color.White
    styleCool.BackColor = Color.Cyan
    styleMild.BackColor = Color.Lime
    styleWarm.BackColor = Color.Yellow
    styleHot.BackColor = Color.Red

    Dim co As New FarPoint.Win.Spread.ComparisonOperator
    FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCold, co.LessThan, "32")
    FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleCool, co.Between, "32", "55")
    FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleMild, co.Between, "55", "75")
    FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleWarm, co.Between, "75", "85")
    FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleHot, co.GreaterThan, "85")
    FpSpread1.ActiveSheet.Cells(1, 1).Value = 38

    The cell(1,1) will be formatted(e.g backcolr and forecolor) base on different conditional format. Thanks

  • Replied 8 September 2017, 1:52 pm EST

    Yvan,


    The code you posted will apply a conditional format to each cell in the column with the TagName set to Lock. Whenever one of the cells in that column has data in it, then that cell will have this condition set (Forecolor to red and locked property to True). It sounds like you want to lock the entire column when one of the cells has a value in it. There is not an easy way to do this. You would need to assign a condition to each one of the cells the way you want.

  • Replied 8 September 2017, 1:52 pm EST

    Hi, 

     

    no, I want to block the line and not the celule

     

    Best regards

    Yvan THEAUDIN
  • Replied 8 September 2017, 1:52 pm EST

    Yvan,


    Here is code to implement what you are looking.


    If TypeOf FpSpread1_Sheet1.Models.Style Is FarPoint.Win.Spread.IConditionalFormatSupport Then


    For i As Integer = 0 To FpSpread1.Sheets(0).RowCount - 1


    FpSpread1_Sheet1.SetConditionalFormat(i, 0, 1, FpSpread1.Sheets(0).ColumnCount, styleHot, FarPoint.Win.Spread.ComparisonOperator.IsFalse, "B" & i + 1 & "=T("""")")


    Next


    End If

  • Replied 8 September 2017, 1:52 pm EST

    Thanks
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels