MESCIUS SPREAD for Windows Forms 15.0J
GetChildWorkbooks メソッド
使用例 

作成されたすべての子ビュー(SpreadViewオブジェクト)を取得します。
構文
'宣言
 
Public Function GetChildWorkbooks() As ArrayList
public ArrayList GetChildWorkbooks()

戻り値の型

階層内の子ワークブック(SpreadView オブジェクト)の ArrayList

使用例
次のサンプルコードは、GetChildWorkbooksメソッドを使用します。
DataSet ds = new DataSet();
DataTable fpParent = new DataTable();
DataTable fpChild1 = new DataTable();
fpParent = ds.Tables.Add("SAMPLE");
fpParent.Columns.AddRange(new DataColumn[] { new DataColumn("Column1", Type.GetType("System.String")), new DataColumn("Column2", Type.GetType("System.Int32")) });
fpParent.Rows.Add(new object[] { "Parent1", 0 });
fpParent.Rows.Add(new object[] { "Parent2", 1 });
fpChild1 = ds.Tables.Add("Child1");
fpChild1.Columns.AddRange(new DataColumn[] {new DataColumn("Column1", Type.GetType("System.String")), new DataColumn("Column2", Type.GetType("System.Int32"))});
fpChild1.Rows.Add(new object[] { "Child1-1", 0 });
fpChild1.Rows.Add(new object[] { "Child1-2", 0 });
fpChild1.Rows.Add(new object[] { "Child1-3", 0 });
fpChild1.Rows.Add(new object[] { "Child2-1", 1 });
fpChild1.Rows.Add(new object[] { "Child2-2", 1 });
fpChild1.Rows.Add(new object[] { "Child2-3", 1 });
ds.Relations.Add("Relation1", fpParent.Columns["Column2"], fpChild1.Columns["Column2"]);
fpSpread1.ActiveSheet.DataSource = ds;
// Expand child hierarchies.
fpSpread1.ActiveSheet.ExpandRow(0, true);
fpSpread1.ActiveSheet.ExpandRow(1, true);

private void button1_Click(object sender, EventArgs e)
{
FarPoint.Win.Spread.SpreadView sv, sv1;
System.Collections.ArrayList al;
sv = fpSpread1.GetRootWorkbook();
al = sv.GetChildWorkbooks();
sv1 = (FarPoint.Win.Spread.SpreadView)al[0];
sv1.GetSheetView().ActiveColumn.BackColor = Color.Yellow;
}
Dim ds As New DataSet
Dim fpParent As DataTable
Dim fpChild1 As DataTable
fpParent = ds.Tables.Add("SAMPLE")
fpParent.Columns.AddRange(New DataColumn() {New DataColumn("Column1", Type.GetType("System.String")), New DataColumn("Column2", Type.GetType("System.Int32"))})
fpParent.Rows.Add(New Object() {"Parent1", 0})
fpParent.Rows.Add(New Object() {"Parent2", 1})
fpChild1 = ds.Tables.Add("Child1")
fpChild1.Columns.AddRange(New DataColumn() {New DataColumn("Column1", Type.GetType("System.String")), New DataColumn("Column2", Type.GetType("System.Int32"))})
fpChild1.Rows.Add(New Object() {"Child1-1", 0})
fpChild1.Rows.Add(New Object() {"Child1-2", 0})
fpChild1.Rows.Add(New Object() {"Child1-3", 0})
fpChild1.Rows.Add(New Object() {"Child2-1", 1})
fpChild1.Rows.Add(New Object() {"Child2-2", 1})
fpChild1.Rows.Add(New Object() {"Child2-3", 1})
ds.Relations.Add("Relation1", fpParent.Columns("Column2"), fpChild1.Columns("Column2"))
FpSpread1.ActiveSheet.DataSource = ds
' Expand child hierarchies.
FpSpread1.ActiveSheet.ExpandRow(0, True)
FpSpread1.ActiveSheet.ExpandRow(1, True)

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sv, sv1 As FarPoint.Win.Spread.SpreadView
Dim al As ArrayList
sv = FpSpread1.GetRootWorkbook()
al = sv.GetChildWorkbooks()
sv1 = CType(al(0), FarPoint.Win.Spread.SpreadView)
sv1.GetSheetView().ActiveColumn.BackColor = Color.Yellow
End Sub
参照

SpreadView クラス
SpreadView メンバ

開発者ガイド

階層表示

 

 


© MESCIUS inc. All rights reserved.