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

NumberFormat is a helper class that creates custom number format strings, which are used for formatting numbers and dates. Use Style.NumberFormat to set a number format for a specific style.

Signature
C#
C#
 public sealed class NumberFormat
{signature}{signature:
}
Signature
vb.net
vb.net
Public NotInheritable Class NumberFormat
{signature}
{example}{code:csharp|title=C#}
Example
Code Block
csharp
csharp
titleC#


          //--- Open a workbook.
          ExcelApplication xla = new ExcelApplication();
          Workbook wb = xla.Open(@"C:\report.xls");

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

          //--- Specify that the number format for the style is a percentage with three
          //--- decimal places (0.000%).
          //--- The following line is equivalent to percentStyle.NumberFormat = "0.000%"
          percentStyle.NumberFormat = wb.NumberFormat.CreatePercentage(3);
        
{code} {code:vbnet|title=
Code Block
vbnet
vbnet
titlevb.net
}


          '--- Open a workbook.
          Dim xla As New ExcelApplication()
          Dim wb As Workbook = xla.Open("C:\report.xls")

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

          '--- Specify that the number format for the style is a percentage with three
          '--- decimal places (0.000%).
          '--- The following line is equivalent to percentStyle.NumberFormat = "0.000%"
          percentStyle.NumberFormat = wb.NumberFormat.CreatePercentage(3)
        
{code} {example} {methods} ||Name||Description|| |[
Methods

...

...

...

Excerpt Include
NumberFormat.CreateAccounting(Int32,

...

Boolean,

...

NumberFormat.Color)

...

NumberFormat.CreateAccounting(Int32,

...

Boolean,

...

NumberFormat.Color)

...

nopanel

...

...

...

...

...

...

Excerpt Include
NumberFormat.CreateCurrency(Int32,

...

Boolean,

...

Boolean,

...

Boolean,

...

NumberFormat.Color)

...

NumberFormat.CreateCurrency(Int32,

...

Boolean,

...

Boolean,

...

Boolean,

...

NumberFormat.Color)

...

nopanel

...

...

...

...

...

...

...

...

...

Excerpt Include
NumberFormat.CreateCurrency(Int32,

...

Boolean,

...

Boolean,

...

NumberFormat.Color,

...

String,

...

String,

...

Boolean,

...

Boolean)

...

NumberFormat.CreateCurrency(Int32,

...

Boolean,

...

Boolean,

...

NumberFormat.Color,

...

String,

...

String,

...

Boolean,

...

Boolean)

...

nopanel

...

...

Excerpt Include
NumberFormat.CreateFraction(Int32)

...

NumberFormat.CreateFraction(Int32)

...

nopanel

...

...

...

Excerpt Include
NumberFormat.CreateFraction(Int32,

...

Int32)

...

NumberFormat.CreateFraction(Int32,

...

Int32)

...

nopanel

...

...

...

...

...

...

...

Excerpt Include
NumberFormat.CreateNumber(Int32,

...

Boolean,

...

Boolean,

...

Boolean,

...

Boolean,

...

NumberFormat.Color)

...

NumberFormat.CreateNumber(Int32,

...

Boolean,

...

Boolean,

...

Boolean,

...

Boolean,

...

NumberFormat.Color)

...

nopanel

...

...

Excerpt Include
NumberFormat.CreatePercentage(Int32)

...

NumberFormat.CreatePercentage(Int32)

...

nopanel

...

...

Excerpt Include
NumberFormat.CreateScientific(Int32)

...

NumberFormat.CreateScientific(Int32)

...

nopanel

...

true
Classes

Name

Description

Color

Excerpt Include
NumberFormat.Color
NumberFormat.Color
nopaneltrue

DateFormat

Excerpt Include
NumberFormat.DateFormat
NumberFormat.DateFormat
nopaneltrue

Special_EN_US

Excerpt Include
NumberFormat.Special_EN_US

...

NumberFormat.Special_EN_US

...

nopanel

...

true

TimeFormat

Excerpt Include

...

NumberFormat.TimeFormat

...

NumberFormat.TimeFormat
nopaneltrue