Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

Creates a format string for displaying numbers.

Signature
C#
C#
 public System.String CreateNumber(int numDecimalPlaces, boolean dropTrailingZeros, boolean use1000Seperator, boolean useNegativeSign, boolean useParensForNegatives, Color negativeColor)
{signature}{signature:
}
Signature
vb.net
vb.net
Public Function CreateNumber(ByVal numDecimalPlaces As Integer, ByVal dropTrailingZeros As Boolean, ByVal use1000Seperator As Boolean, ByVal useNegativeSign As Boolean, ByVal useParensForNegatives As Boolean, ByVal negativeColor As Color) As String
{signature}
{parameters}
{param:numDecimalPlaces}The number of decimal places to display.{param}
{param:dropTrailingZeros}If {{true}}, trailing zeros will be dropped.  If {{false}}, trailing zeros will be displayed.{param}
{param:use1000Seperator}If {{true}}, the 1000 separator \(,\) will be displayed.{param}
{param:useNegativeSign}If {{true}}, the negative sign will be used.{param}
{param:useParensForNegatives}If {{true}}, negative numbers will be shown in parentheses.{param}
{param:negativeColor}A color to use when displaying negative numbers.  {{negativeColor}} may be null.{param}
{returns}A number format string.{returns}
{example}{code:csharp|title=C#}
Parameters
Param
numDecimalPlaces
numDecimalPlaces

The number of decimal places to display.

Param
dropTrailingZeros
dropTrailingZeros

If true, trailing zeros will be dropped. If false, trailing zeros will be displayed.

Param
use1000Seperator
use1000Seperator

If true, the 1000 separator (,) will be displayed.

Param
useNegativeSign
useNegativeSign

If true, the negative sign will be used.

Param
useParensForNegatives
useParensForNegatives

If true, negative numbers will be shown in parentheses.

Param
negativeColor
negativeColor

A color to use when displaying negative numbers. negativeColor may be null.

Returns

A number format string.

Example
Code Block
csharp
csharp
titleC#


          //--- Create a style.
          Style styl = wb.CreateStyle();

          //--- The following assigns the number string "#,##0.##;-#,##0.##"
          //--- to the style.
          styl.NumberFormat =
               wb.NumberFormat.CreateNumber(2,
               true,
               true,
               true,
               false,
               NumberFormat.Color.Red);
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- Create a style.
          Dim styl As Style = wb.CreateStyle()

          '--- The following assigns the number string "#,##0.##;-#,##0.##"
          '--- to the style.
          styl.NumberFormat = _
               wb.NumberFormat.CreateNumber(2, _
               True, _
               True, _
               True, _
               False, _
               NumberFormat.Color.Redl)
        
{code} {example}