作成日: 2017/10/12 最終更新日: 2017/10/12
文書種別
使用方法
詳細
生成(Runメソッド実行)後のセクションレポートに、後付けで文字列や図形を描画したい場合、PagesコレクションのDrawTextやDrawLineなどのDraw***メソッドを使用します。
たとえば、複数のセクションレポートを合成してから全体を通したページ番号を描画したい場合、以下のようにDrawTextメソッドを使用することで実現可能です。
※レポートの合成については関連情報をご参照ください。
◆サンプルコード(VB.NET)
◆サンプルコード(C#)
各メソッドの詳細については、製品ヘルプの以下のトピックをご確認ください。
クラスライブラリリファレンス
- GrapeCity.ActiveReports.Document.v11 アセンブリ
- 名前空間
- GrapeCity.ActiveReports.Document.Section 名前空間
- クラス
- Page
- メソッド
- Draw
- DrawBorder
- DrawEllipse
- DrawImage
- DrawLine
- DrawRect
- DrawRoundRect
- DrawText
たとえば、複数のセクションレポートを合成してから全体を通したページ番号を描画したい場合、以下のようにDrawTextメソッドを使用することで実現可能です。
※レポートの合成については関連情報をご参照ください。
◆サンプルコード(VB.NET)
Dim rpt1 As New SectionReport1() ' レポート1
Dim rpt2 As New SectionReport2() ' レポート2
' それぞれのレポートを作成します。
rpt1.Run()
rpt2.Run()
' レポート1にレポート2をマージします。
rpt1.Document.Pages.AddRange(rpt2.Document.Pages.Clone)
' レポートの下部にページ番号を描画します。
For i As Integer = 0 To rpt1.Document.Pages.Count - 1
rpt1.Document.Pages(i).Font = New Font("MS ゴシック", 10.5)
rpt1.Document.Pages(i).ForeColor = Color.Black
rpt1.Document.Pages(i).DrawText((i + 1).ToString(),
GrapeCity.ActiveReports.SectionReport.CmToInch(21.0 / 2.0),
GrapeCity.ActiveReports.SectionReport.CmToInch(29.7 - 1.0),
GrapeCity.ActiveReports.SectionReport.CmToInch(2.0),
GrapeCity.ActiveReports.SectionReport.CmToInch(1.0))
Next
Dim rpt2 As New SectionReport2() ' レポート2
' それぞれのレポートを作成します。
rpt1.Run()
rpt2.Run()
' レポート1にレポート2をマージします。
rpt1.Document.Pages.AddRange(rpt2.Document.Pages.Clone)
' レポートの下部にページ番号を描画します。
For i As Integer = 0 To rpt1.Document.Pages.Count - 1
rpt1.Document.Pages(i).Font = New Font("MS ゴシック", 10.5)
rpt1.Document.Pages(i).ForeColor = Color.Black
rpt1.Document.Pages(i).DrawText((i + 1).ToString(),
GrapeCity.ActiveReports.SectionReport.CmToInch(21.0 / 2.0),
GrapeCity.ActiveReports.SectionReport.CmToInch(29.7 - 1.0),
GrapeCity.ActiveReports.SectionReport.CmToInch(2.0),
GrapeCity.ActiveReports.SectionReport.CmToInch(1.0))
Next
◆サンプルコード(C#)
SectionReport1 rpt1 = new SectionReport1(); //レポート1
SectionReport2 rpt2 = new SectionReport2(); //レポート2
// それぞれのレポートを作成します。
rpt1.Run(false);
rpt2.Run(false);
// レポート1にレポート2をマージします。
rpt1.Document.Pages.AddRange
((GrapeCity.ActiveReports.Document.Section.PagesCollection)rpt2.Document.Pages.Clone());
// レポートの下部にページ番号を描画します。
for (int i = 0; i < rpt1.Document.Pages.Count; i++)
{
rpt1.Document.Pages[i].Font = new Font("MS ゴシック", 10.5f);
rpt1.Document.Pages[i].ForeColor = Color.Black;
rpt1.Document.Pages[i].DrawText((i + 1).ToString(),
GrapeCity.ActiveReports.SectionReport.CmToInch(21.0f / 2.0f),
GrapeCity.ActiveReports.SectionReport.CmToInch(29.7f - 1.0f),
GrapeCity.ActiveReports.SectionReport.CmToInch(2.0f),
GrapeCity.ActiveReports.SectionReport.CmToInch(1.0f));
}
SectionReport2 rpt2 = new SectionReport2(); //レポート2
// それぞれのレポートを作成します。
rpt1.Run(false);
rpt2.Run(false);
// レポート1にレポート2をマージします。
rpt1.Document.Pages.AddRange
((GrapeCity.ActiveReports.Document.Section.PagesCollection)rpt2.Document.Pages.Clone());
// レポートの下部にページ番号を描画します。
for (int i = 0; i < rpt1.Document.Pages.Count; i++)
{
rpt1.Document.Pages[i].Font = new Font("MS ゴシック", 10.5f);
rpt1.Document.Pages[i].ForeColor = Color.Black;
rpt1.Document.Pages[i].DrawText((i + 1).ToString(),
GrapeCity.ActiveReports.SectionReport.CmToInch(21.0f / 2.0f),
GrapeCity.ActiveReports.SectionReport.CmToInch(29.7f - 1.0f),
GrapeCity.ActiveReports.SectionReport.CmToInch(2.0f),
GrapeCity.ActiveReports.SectionReport.CmToInch(1.0f));
}
各メソッドの詳細については、製品ヘルプの以下のトピックをご確認ください。
クラスライブラリリファレンス
- GrapeCity.ActiveReports.Document.v11 アセンブリ
- 名前空間
- GrapeCity.ActiveReports.Document.Section 名前空間
- クラス
- Page
- メソッド
- Draw
- DrawBorder
- DrawEllipse
- DrawImage
- DrawLine
- DrawRect
- DrawRoundRect
- DrawText
関連情報
旧文書番号
41378