IConditionalFormat problemes

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

  • Posted 8 September 2017, 1:52 pm EST

    <FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2> Hi,</FONT></FONT>


    <FONT color=#0000ff size=2><FONT color=#0000ff size=2> <FONT color=#000000>I do not understand, setconditionnalformat not function on the column of fiter?</FONT></FONT></FONT>


    <FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> styleHot </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT size=2> FarPoint.Win.Spread.NamedStyle


    styleHot.ForeColor = Color.Red


    styleHot.Locked = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>True

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>If</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>TypeOf</FONT></FONT><FONT size=2> FpSpread2_Sheet1.Models.Style </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Is</FONT></FONT><FONT size=2> FarPoint.Win.Spread.IConditionalFormatSupport </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Then

    </FONT></FONT><FONT size=2>

    FpSpread2_Sheet1.SetConditionalFormat(-1, FpSpread2_Sheet1.Columns(</FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"Lock"</FONT></FONT><FONT size=2>).Index, styleHot, FarPoint.Win.Spread.ComparisonOperator.NotEqualTo, </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"T("""")"</FONT></FONT><FONT size=2>)</FONT><FONT size=2>


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>If</FONT></FONT>


    <FONT color=#0000ff size=2><FONT color=#0000ff size=2>best regards

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

    Hi


    <DIV style="TEXT-ALIGN:left;" id=result_box>I want to apply a style to a line condition</DIV>
    <DIV style="TEXT-ALIGN:left;"> </DIV>
    <DIV style="TEXT-ALIGN:left;">thanks </DIV>
    <DIV style="TEXT-ALIGN:left;"> </DIV>
    <DIV style="TEXT-ALIGN:left;">Yvan TEHAUDIN</DIV>
  • Replied 8 September 2017, 1:52 pm EST

    Hello,

    I am not clear with the requirement "<font size="2" color="#0000ff"><font size="2" color="#0000ff"><font color="#000000">setconditionnalformat not function on the column of fiter</font></font></font>". 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

    <blockquote>

    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

    </blockquote>

    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

    <DIV style="TEXT-ALIGN:left;" id=result_box>Hi, </DIV>
    <DIV style="TEXT-ALIGN:left;"> </DIV>
    <DIV style="TEXT-ALIGN:left;">no, I want to block the line and not the celule</DIV>
    <DIV style="TEXT-ALIGN:left;"> </DIV>
    <DIV style="TEXT-ALIGN:left;">Best regards</DIV>
    <DIV style="TEXT-ALIGN:left;">Yvan THEAUDIN</DIV>
  • Replied 8 September 2017, 1:52 pm EST

    Yvan,


    Here is code to implement what you are looking.

    <FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>If</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>TypeOf</FONT></FONT><FONT size=2> FpSpread1_Sheet1.Models.Style </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Is</FONT></FONT><FONT size=2> FarPoint.Win.Spread.IConditionalFormatSupport </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Then

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>For</FONT></FONT><FONT size=2> i </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Integer</FONT></FONT><FONT size=2> = 0 </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>To</FONT></FONT><FONT size=2> FpSpread1.Sheets(0).RowCount - 1


    FpSpread1_Sheet1.SetConditionalFormat(i, 0, 1, FpSpread1.Sheets(0).ColumnCount, styleHot, FarPoint.Win.Spread.ComparisonOperator.IsFalse, </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"B"</FONT></FONT><FONT size=2> & i + 1 & </FONT><FONT color=#a31515 size=2><FONT color=#a31515 size=2>"=T("""")"</FONT></FONT><FONT size=2>)


    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Next

    </FONT></FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>End</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>If

    </FONT></FONT>
  • 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