Negative Format

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

  • Posted 8 September 2017, 12:50 pm EST

    <FONT face=Arial>Hi,</FONT>


    <FONT face=Arial>How to display a negative value in the below format?</FONT>


    <FONT color=#ff0000>(7.0)$</FONT>


    <FONT face=Arial>Thanks,</FONT>


    <FONT face=Arial>rkerkar</FONT>

  • Replied 8 September 2017, 12:50 pm EST

    Hello,


    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.

     
    		<SPAN class=kwd>Dim</SPAN> c <SPAN class=kwd>As New</SPAN> FarPoint.Win.Spread.CellType.CurrencyCellType
    c.NegativeFormat = FarPoint.Win.Spread.CellType.CurrencyNegativeFormat.ParenthesesSymbolAfter

    c.NegativeRed = <SPAN class=kwd>True</SPAN>
    </PRE>
    <P> You can create a custom celltype with your own format.

     
    		<SPAN class=kwd>Dim</SPAN> c2 <SPAN class=kwd>As New</SPAN> FarPoint.Win.Spread.CellType.GeneralCellType
    c2.IsDateFormat = <SPAN class=kwd>False</SPAN>
    c2.FormatString = <SPAN class=st>"#,##0.00$;(#,##0.00)$;0"</SPAN>
    <SPAN class=kwd>Dim</SPAN> ns <SPAN class=kwd>As New</SPAN> FarPoint.Win.Spread.NamedStyle
    FpSpread1.Sheets(0).NamedStyles.Add(ns)
    ns.ForeColor = Color.Red
    FpSpread1.Sheets(0).Cells(2, 2).CellType = c2
    FpSpread1.Sheets(0).SetConditionalFormat(2, 2, ns, FarPoint.Win.Spread.ComparisonOperator.LessThan, <SPAN class=st>"0"</SPAN>)
    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