【セル型】 通貨記号を表示させずに数字を3桁ごとにカンマで区切って表示する方法

文書番号 : 21797     文書種別 : 使用方法     最終更新日 : 2006/06/23
文書を印刷する
対象製品
SPREAD for .NET 2.5J Web Forms Edition
詳細
IntegerCellTypeクラスのNumberFormatプロパティを使用します。

[サンプルコード]

●VBサンプルコード
Imports FarPoint.Web.Spread
Imports System.Globalization
     :
  '整数型セルの設定
  Dim ic As New IntegerCellType
  Dim ninfo As NumberFormatInfo = CType(CultureInfo.CurrentCulture.NumberFormat.Clone(),NumberFormatInfo)
  ninfo.NumberGroupSizes = New Int32(){3} '整数部は3桁区切り
  ic.NumberFormat=ninfo

  'セル型を1列目に設定
  FpSpread1.Sheets(0).Columns(0).CellType = ic
  FpSpread1.Sheets(0).Cells(0,0).Value=9999 'A1セル


●C#サンプルコード
using FarPoint.Web.Spread;
using System.Globalization;
     :
  //整数型セルの設定
  IntegerCellType ic=new IntegerCellType();
  NumberFormatInfo ninfo=(NumberFormatInfo)CultureInfo.CurrentCulture.NumberFormat.Clone();
  ninfo.NumberGroupSizes=new Int32[]{3};//整数部は3桁区切り
  ic.NumberFormat=ninfo;

  //セル型を1列目に設定
  FpSpread1.Sheets[0].Columns[0].CellType=ic;
  FpSpread1.Sheets[0].Cells[0,0].Value=9999;//A1セル


[実行時に表示される値]

A1セル・・・「9,999」と表示されます。
関連情報
キーワード
外観 セル型

この文書は、以前は次のFAQ IDで公開されていました : 9121