Spread for ASP.NET 8.0 Product Documentation
NumberFormat Property (IntegerCellType)
Example 


Gets or sets a NumberFormatInfo which is used to format the numeric value, such as for currency.
Syntax
'Declaration
 
Public Overrides Property NumberFormat As NumberFormatInfo
'Usage
 
Dim instance As IntegerCellType
Dim value As NumberFormatInfo
 
instance.NumberFormat = value
 
value = instance.NumberFormat
public override NumberFormatInfo NumberFormat {get; set;}
Example
This example sets a format when the cell is in edit mode.
FpSpread1.Sheets[0].ColumnCount = 10;
FpSpread1.Sheets[0].RowCount = 10;
FpSpread1.Sheets[0].SetClip(0, 0, 8, 1, "CurrencyCellType\n" + "DateTimeCellType\n" + "DoubleCellType\n" + "IntegerCellType\n");
// --------------------------------------------------
// CurrencyCellType, with EditMode format settings
// --------------------------------------------------
FarPoint.Web.Spread.CurrencyCellType cct = new FarPoint.Web.Spread.CurrencyCellType();
cct.NumberFormat = new System.Globalization.NumberFormatInfo();
cct.NumberFormat.CurrencySymbol = "D";
cct.EditMode.NumberFormat = new System.Globalization.NumberFormatInfo();
cct.EditMode.NumberFormat.CurrencySymbol = "VND";
FpSpread1.Sheets[0].Cells[0, 1].CellType = cct;
FpSpread1.Sheets[0].Cells[0, 1].Value = 12;
// --------------------------------------------------
// DateTimeCellType, with EditMode format settings
// --------------------------------------------------
FarPoint.Web.Spread.DateTimeCellType dct = new FarPoint.Web.Spread.DateTimeCellType();
dct.DateTimeFormat = new System.Globalization.DateTimeFormatInfo();
dct.FormatString = "dd/MM/yyyy";
dct.EditMode.DateTimeFormat = new System.Globalization.DateTimeFormatInfo();
dct.EditMode.FormatString = "MM/dd/yyyy";
FpSpread1.Sheets[0].Cells[1, 1].CellType = dct;
FpSpread1.Sheets[0].Cells[1, 1].Value = DateTime.Now.ToShortDateString();
// --------------------------------------------------
// DoubleCellType, with EditMode format settings
// --------------------------------------------------
FarPoint.Web.Spread.DoubleCellType dbct = new FarPoint.Web.Spread.DoubleCellType();
dbct.NumberFormat = new System.Globalization.NumberFormatInfo();
dbct.NumberFormat.NumberDecimalSeparator = ".";
dbct.EditMode.NumberFormat = new System.Globalization.NumberFormatInfo();
dbct.EditMode.NumberFormat.NumberDecimalSeparator = ",";
FpSpread1.Sheets[0].Cells[2, 1].CellType = dbct;
FpSpread1.Sheets[0].Cells[2, 1].Value = 12.1d;
// --------------------------------------------------
// IntegerCellType, with EditMode format settings
// --------------------------------------------------
FarPoint.Web.Spread.IntegerCellType ict = new FarPoint.Web.Spread.IntegerCellType();
ict.NumberFormat = new System.Globalization.NumberFormatInfo();
ict.NumberFormat.NegativeSign = "~";
ict.EditMode.NumberFormat = new System.Globalization.NumberFormatInfo();
ict.EditMode.NumberFormat.NegativeSign = "@";
FpSpread1.Sheets[0].Cells[3, 1].CellType = ict;
FpSpread1.Sheets[0].Cells[3, 1].Value = -12;
FpSpread1.Sheets(0).ColumnCount = 10
FpSpread1.Sheets(0).RowCount = 10
FpSpread1.Sheets(0).SetClip(0, 0, 8, 1, "CurrencyCellType" & vbLf + "DateTimeCellType" & vbLf + "DoubleCellType" & vbLf + "IntegerCellType")
' --------------------------------------------------
' CurrencyCellType, with EditMode format settings
' --------------------------------------------------
Dim cct As New FarPoint.Web.Spread.CurrencyCellType()
cct.NumberFormat = New System.Globalization.NumberFormatInfo()
cct.NumberFormat.CurrencySymbol = "D"
cct.EditMode.NumberFormat = New System.Globalization.NumberFormatInfo()
cct.EditMode.NumberFormat.CurrencySymbol = "VND"
FpSpread1.Sheets(0).Cells(0, 1).CellType = cct
FpSpread1.Sheets(0).Cells(0, 1).Value = 12
' --------------------------------------------------
' DateTimeCellType, with EditMode format settings
' --------------------------------------------------
Dim dct As New FarPoint.Web.Spread.DateTimeCellType()
dct.DateTimeFormat = New System.Globalization.DateTimeFormatInfo()
dct.FormatString = "dd/MM/yyyy"
dct.EditMode.DateTimeFormat = New System.Globalization.DateTimeFormatInfo()
dct.EditMode.FormatString = "MM/dd/yyyy"
FpSpread1.Sheets(0).Cells(1, 1).CellType = dct
FpSpread1.Sheets(0).Cells(1, 1).Value = DateTime.Now.ToShortDateString()
' --------------------------------------------------
' DoubleCellType, with EditMode format settings
' --------------------------------------------------
Dim dbct As New FarPoint.Web.Spread.DoubleCellType()
dbct.NumberFormat = New System.Globalization.NumberFormatInfo()
dbct.NumberFormat.NumberDecimalSeparator = "."
dbct.EditMode.NumberFormat = New System.Globalization.NumberFormatInfo()
dbct.EditMode.NumberFormat.NumberDecimalSeparator = ","
FpSpread1.Sheets(0).Cells(2, 1).CellType = dbct
FpSpread1.Sheets(0).Cells(2, 1).Value = 12.1D
' --------------------------------------------------
' IntegerCellType, with EditMode format settings
' --------------------------------------------------
Dim ict As New FarPoint.Web.Spread.IntegerCellType()
ict.NumberFormat = New System.Globalization.NumberFormatInfo()
ict.NumberFormat.NegativeSign = "~"
ict.EditMode.NumberFormat = New System.Globalization.NumberFormatInfo()
ict.EditMode.NumberFormat.NegativeSign = "@"
FpSpread1.Sheets(0).Cells(3, 1).CellType = ict
FpSpread1.Sheets(0).Cells(3, 1).Value = -12
Requirements

Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

IntegerCellType Class
IntegerCellType Members

 

 


Copyright © GrapeCity, inc. All rights reserved.