MESCIUS SPREAD for ASP.NET 10.0J
NumberFormat プロパティ (IntegerCellType)

通貨など数値の書式を設定するためのNumberFormatInfoを取得または設定します。
構文
'Declaration
 
Public Overrides Property NumberFormat As NumberFormatInfo
public override NumberFormatInfo NumberFormat {get; set;}
次のサンプルコードは、セルが編集を開始した時の書式を設定します。
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
参照

IntegerCellType クラス
IntegerCellType メンバ

 

 


© MESCIUS inc. All rights reserved.