Negative Format

Posted by: rkerkar on 8 September 2017, 12:50 pm EST

  • Posted 8 September 2017, 12:50 pm EST


    How to display a negative value in the below format?




  • Replied 8 September 2017, 12:50 pm EST


    There is a built in format in Spread CurrencyCellType to get the format you listed above with the $ inside the parenthesis, but not one for outside the parenthesis.

    		Dim c As New FarPoint.Win.Spread.CellType.CurrencyCellType
    c.NegativeFormat = FarPoint.Win.Spread.CellType.CurrencyNegativeFormat.ParenthesesSymbolAfter

    c.NegativeRed = True

     You can create a custom celltype with your own format.

    		Dim c2 As New FarPoint.Win.Spread.CellType.GeneralCellType
    c2.IsDateFormat = False
    c2.FormatString = "#,##0.00$;(#,##0.00)$;0"
    Dim ns As New FarPoint.Win.Spread.NamedStyle
    ns.ForeColor = Color.Red
    FpSpread1.Sheets(0).Cells(2, 2).CellType = c2
    FpSpread1.Sheets(0).SetConditionalFormat(2, 2, ns, FarPoint.Win.Spread.ComparisonOperator.LessThan, "0")
    FpSpread1.Sheets(0).Cells(2, 2).Value = -7
Need extra support?

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

Learn More

Forum Channels