【セル型】 小数点以下桁数を設定する方法
対象製品
SPREAD for .NET 2.5J Web Forms Edition
詳細
DoubleCellType クラスのDecimalDegitsプロパティにて小数点以下桁数を設定できます。
【VB サンプルコード】
【C# サンプルコード】
【VB サンプルコード】
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IsPostBack Then Return
'小数点以下桁数を2桁に設定
Dim dc As New DoubleCellType
dc.DecimalDigits = 2
'1列目にセル型を設定
FpSpread1.ActiveSheetView.Columns(0).CellType = dc
'テストデータを設定
FpSpread1.ActiveSheetView.Cells(0, 0).Value = 1.235
End Sub
If IsPostBack Then Return
'小数点以下桁数を2桁に設定
Dim dc As New DoubleCellType
dc.DecimalDigits = 2
'1列目にセル型を設定
FpSpread1.ActiveSheetView.Columns(0).CellType = dc
'テストデータを設定
FpSpread1.ActiveSheetView.Cells(0, 0).Value = 1.235
End Sub
【C# サンプルコード】
private void Page_Load(object sender, System.EventArgs e)
{
if(IsPostBack)return;
//小数点以下桁数を2桁に設定
DoubleCellType dc=new DoubleCellType();
dc.DecimalDigits=2;
//1列目にセル型を設定
FpSpread1.ActiveSheetView.Columns[0].CellType=dc;
//テストデータを設定
FpSpread1.ActiveSheetView.Cells[0,0].Value=1.235;
}
{
if(IsPostBack)return;
//小数点以下桁数を2桁に設定
DoubleCellType dc=new DoubleCellType();
dc.DecimalDigits=2;
//1列目にセル型を設定
FpSpread1.ActiveSheetView.Columns[0].CellType=dc;
//テストデータを設定
FpSpread1.ActiveSheetView.Cells[0,0].Value=1.235;
}
関連情報
キーワード
セル型 一般
この文書は、以前は次のFAQ IDで公開されていました : 9125