【セル型】コードでチェックボックス型セルのチェックをつけたい

文書番号 : 37998     文書種別 : 使用方法     登録日 : 2015/02/26     最終更新日 : 2015/02/26
文書を印刷する
対象製品
SPREAD for ASP.NET 8.0J
詳細
セルのValue プロパティにより、チェックボックスにチェックをつけたり外したりすることができます。

◎サンプルコード(VB)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  If IsPostBack Then
    Return
  End If

  Dim c As New FarPoint.Web.Spread.CheckBoxCellType
  FpSpread1.ActiveSheetView.Cells(1, 1).CellType = c

  FpSpread1.ActiveSheetView.Cells(1, 1).Value = True
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
  ' クライアントの変更を確定します
  FpSpread1.SaveChanges()

  FpSpread1.ActiveSheetView.Cells(1, 1).Value = False
End Sub

◎サンプルコード(C#)
protected void Page_Load(object sender, EventArgs e)
{
  if (Page.IsPostBack)
  {
    return;
  }

  FarPoint.Web.Spread.CheckBoxCellType c = new FarPoint.Web.Spread.CheckBoxCellType();
  FpSpread1.ActiveSheetView.Cells[1, 1].CellType = c;

  FpSpread1.ActiveSheetView.Cells[1, 1].Value = true;
}

protected void Button1_Click(object sender, EventArgs e)
{
  // クライアントの変更を確定します
  FpSpread1.SaveChanges();

  FpSpread1.ActiveSheetView.Cells[1, 1].Value = false;
}
キーワード
セル型