private void Form1_Load(object sender, System.EventArgs e)
{
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[] {"親1", 0});
fpParent.Rows.Add(new object[] {"親2", 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[] {"子1-1", 0});
fpChild1.Rows.Add(new object[] {"印刷する子階層シート", 1});
ds.Relations.Add("Relation1", fpParent.Columns["Column2"], fpChild1.Columns["Column2"]);
fpSpread1.ActiveSheet.DataSource = ds;
//全ての階層を展開します
fpSpread1.ActiveSheet.ExpandRow(0, true);
fpSpread1.ActiveSheet.ExpandRow(1, true);
}
private void button1_Click(object sender, System.EventArgs e)
{
//2行目に関連付けられている子階層シートビューを取得します
FarPoint.Win.Spread.SheetView csv = fpSpread1.ActiveSheet.GetChildView(1, 0);
if (csv != null)
{
//印刷プレビュー画面を表示します
csv.PrintInfo.Preview = true;
//取得した子階層シートビューを印刷します
fpSpread1.PrintSheet(csv);
}
}
private void fpSpread1_PrintPreviewShowing(object sender, FarPoint.Win.Spread.PrintPreviewShowingEventArgs e)
{
//表示倍率150%で印刷プレビュー画面を表示します
e.PreviewControl.Zoom = 1.5;
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
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() {"親1", 0})
fpParent.Rows.Add(New Object() {"親2", 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() {"子1-1", 0})
fpChild1.Rows.Add(New Object() {"印刷する子階層シート", 1})
ds.Relations.Add("Relation1", fpParent.Columns("Column2"), fpChild1.Columns("Column2"))
FpSpread1.ActiveSheet.DataSource = ds
'全ての階層を展開します
FpSpread1.ActiveSheet.ExpandRow(0, True)
FpSpread1.ActiveSheet.ExpandRow(1, True)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'2行目に関連付けられている子階層シートビューを取得します
Dim csv As FarPoint.Win.Spread.SheetView = FpSpread1.ActiveSheet.GetChildView(1, 0)
If Not (csv Is Nothing) Then
'印刷プレビュー画面を表示します
csv.PrintInfo.Preview = True
'取得した子階層シートビューを印刷します
FpSpread1.PrintSheet(csv)
End If
End Sub
Private Sub FpSpread1_PrintPreviewShowing(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintPreviewShowingEventArgs) Handles FpSpread1.PrintPreviewShowing
'表示倍率150%で印刷プレビュー画面を表示します
e.PreviewControl.Zoom = 1.5
End Sub