GrapeCity Forums

The GrapeCity Message Boards
Welcome to GrapeCity Forums Sign in | Join | Help
in Search

Formula and cell BackColor

Last post 06-24-2009, 10:00 AM by fance.liu. 2 replies.
Sort Posts: Previous Next
  •  06-24-2009, 3:08 AM 79427

    Formula and cell BackColor

    this.fpSpread1.ActiveSheet.Cells[cc.rows, m + 5].Formula = "IF(OR(" + gs + (cc.rows - 1).ToString() + "=\"0\"," + gs + (cc.rows - 1).ToString() + "=\"\")," + gs + (cc.rows - 2).ToString() + "," + gs + (cc.rows - 1).ToString() + ")-" + gs + (cc.rows - 0).ToString() + "";

     If this cell value is less than zero, so I took him to change the background color.How do

     

  •  06-24-2009, 8:18 AM 79441 in reply to 79427

    Re: Formula and cell BackColor

     Hello,

    I am not sure what formula you are using, however to change the background color of a cell for a given condition you may use SetConditionalFormat( ) method.Below is the code snippet that will change the back color of  the cell(1,1) if the value is less than zero,

    Dim styleRed As New FarPoint.Win.Spread.NamedStyle()

    styleRed.BackColor = Color.Red

    FpSpread1.ActiveSheet.SetConditionalFormat(1, 1, styleRed, FarPoint.Win.Spread.ComparisonOperator.LessThan, "0")

     

    I hope it will help you.

    Regards,

     


    Deepak Sharma
    GrapeCity FarPoint
  •  06-24-2009, 10:00 AM 79446 in reply to 79441

    Re: Formula and cell BackColor

    TKS,It's very useful for me
View as RSS news feed in XML
     FarPoint Forums Home