MESCIUS SPREAD for Windows Forms 15.0J サンプルコード集
計算列の自動作成

テーブル内の列に入力された数式に基づいて、同一の列に対して数式を自動的に設定できます。本機能を有効にするにはIFeaturesインターフェースのAutoCreateCalculatedColumns プロパティを有効にします。

新しいスタイルシステム(LegacyBehaviorsプロパティがStyleを含まない場合)で有効です。

【実行例】数式の入力中

【実行例】数式の入力後

private void Form1_Load(object sender, EventArgs e)
 {
  // テストデータの設定
  fpSpread1.ActiveSheet.Cells[0, 0].Value = "名前";
  fpSpread1.ActiveSheet.Cells[0, 1].Value = "性別";
  fpSpread1.ActiveSheet.Cells[0, 2].Value = "報酬";
  fpSpread1.ActiveSheet.Cells[1, 0].Value = "佐藤";
  fpSpread1.ActiveSheet.Cells[1, 1].Value = "男";
  fpSpread1.ActiveSheet.Cells[1, 2].Value = 300000;
  fpSpread1.ActiveSheet.Cells[2, 0].Value = "高橋";
  fpSpread1.ActiveSheet.Cells[2, 1].Value = "男";
  fpSpread1.ActiveSheet.Cells[2, 2].Value = 300000;
  fpSpread1.ActiveSheet.Cells[3, 0].Value = "木村";
  fpSpread1.ActiveSheet.Cells[3, 1].Value = "女";
  fpSpread1.ActiveSheet.Cells[3, 2].Value = 320000;
  fpSpread1.ActiveSheet.Cells[4, 0].Value = "高山";
  fpSpread1.ActiveSheet.Cells[4, 1].Value = "女";
  fpSpread1.ActiveSheet.Cells[4, 2].Value = 270000;
  fpSpread1.ActiveSheet.Cells[0, 3].Value = "年額";

  // テーブルの追加
  fpSpread1.ActiveSheet.AddTable("table1", 0, 0, 5, 4);

  // 計算列の自動作成を有効
  fpSpread1.Features.AutoCreateCalcuatedTableColumns = true;
 }
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

  ' テストデータの設定
  FpSpread1.ActiveSheet.Cells(0, 0).Value = "名前"
  FpSpread1.ActiveSheet.Cells(0, 1).Value = "性別"
  FpSpread1.ActiveSheet.Cells(0, 2).Value = "報酬"
  FpSpread1.ActiveSheet.Cells(1, 0).Value = "佐藤"
  FpSpread1.ActiveSheet.Cells(1, 1).Value = "男"
  FpSpread1.ActiveSheet.Cells(1, 2).Value = 300000
  FpSpread1.ActiveSheet.Cells(2, 0).Value = "高橋"
  FpSpread1.ActiveSheet.Cells(2, 1).Value = "男"
  FpSpread1.ActiveSheet.Cells(2, 2).Value = 300000
  FpSpread1.ActiveSheet.Cells(3, 0).Value = "木村"
  FpSpread1.ActiveSheet.Cells(3, 1).Value = "女"
  FpSpread1.ActiveSheet.Cells(3, 2).Value = 320000
  FpSpread1.ActiveSheet.Cells(4, 0).Value = "高山"
  FpSpread1.ActiveSheet.Cells(4, 1).Value = "女"
  FpSpread1.ActiveSheet.Cells(4, 2).Value = 270000
  FpSpread1.ActiveSheet.Cells(0, 3).Value = "年額"

  ' テーブルの追加
  FpSpread1.ActiveSheet.AddTable("table1", 0, 0, 5, 4)

  ' 計算列の自動作成を有効
  FpSpread1.Features.AutoCreateCalcuatedTableColumns = True

 End Sub

 

 


© MESCIUS inc. All rights reserved.