Wiki Markup |
---|
{description} {excerpt}[NumberFormat|NumberFormat] is a helper class that creates custom number format strings, which are used for formatting numbers and dates. Use [Style.NumberFormat|Style.NumberFormat] to set a number format for a specific style.{excerpt} {signature:C#} public sealed class NumberFormat {signature}{signature:vb.net} Public NotInheritable Class NumberFormat {signature} {example}{code:csharp|title=C#} //--- 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=vb.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|| |[CreateAccounting(Int32, Boolean, NumberFormat.Color)|NumberFormat.CreateAccounting(Int32, Boolean, NumberFormat.Color)]|{excerpt-include:NumberFormat.CreateAccounting(Int32, Boolean, NumberFormat.Color)|nopanel=true}| |[CreateCurrency(Int32, Boolean, Boolean, Boolean, NumberFormat.Color)|NumberFormat.CreateCurrency(Int32, Boolean, Boolean, Boolean, NumberFormat.Color)]|{excerpt-include:NumberFormat.CreateCurrency(Int32, Boolean, Boolean, Boolean, NumberFormat.Color)|nopanel=true}| |[CreateCurrency(Int32, Boolean, Boolean, NumberFormat.Color, String, String, Boolean, Boolean)|NumberFormat.CreateCurrency(Int32, Boolean, Boolean, NumberFormat.Color, String, String, Boolean, Boolean)]|{excerpt-include:NumberFormat.CreateCurrency(Int32, Boolean, Boolean, NumberFormat.Color, String, String, Boolean, Boolean)|nopanel=true}| |[CreateFraction(Int32)|NumberFormat.CreateFraction(Int32)]|{excerpt-include:NumberFormat.CreateFraction(Int32)|nopanel=true}| |[CreateFraction(Int32, Int32)|NumberFormat.CreateFraction(Int32, Int32)]|{excerpt-include:NumberFormat.CreateFraction(Int32, Int32)|nopanel=true}| |[CreateNumber(Int32, Boolean, Boolean, Boolean, Boolean, NumberFormat.Color)|NumberFormat.CreateNumber(Int32, Boolean, Boolean, Boolean, Boolean, NumberFormat.Color)]|{excerpt-include:NumberFormat.CreateNumber(Int32, Boolean, Boolean, Boolean, Boolean, NumberFormat.Color)|nopanel=true}| |[CreatePercentage(Int32)|NumberFormat.CreatePercentage(Int32)]|{excerpt-include:NumberFormat.CreatePercentage(Int32)|nopanel=true}| |[CreateScientific(Int32)|NumberFormat.CreateScientific(Int32)]|{excerpt-include:NumberFormat.CreateScientific(Int32)|nopanel=true}| {classes} ||Name||Description|| |[Color|NumberFormat.Color]|{excerpt-include:NumberFormat.Color|nopanel=true}| |[DateFormat|NumberFormat.DateFormat]|{excerpt-include:NumberFormat.DateFormat|nopanel=true}| |[Special_EN_US|NumberFormat.Special_EN_US]|{excerpt-include:NumberFormat.Special_EN_US|nopanel=true}| |[TimeFormat|NumberFormat.TimeFormat]|{excerpt-include:NumberFormat.TimeFormat|nopanel=true}| |
Page History
Overview
Content Tools