作成日: 2026/03/25 最終更新日: 2026/03/25
文書種別
使用方法
詳細
SectionDocumentまたはPageDocumentクラスのPrinterプロパティのEndPrintイベントを使用して印刷処理の終了を判断できます。
なお、16.0J以前のバージョンでは.NET標準のSystem.Drawing.Printing名前空間に属するEndPrintイベントを使用していましたが、18.0J以降ではGrapeCity.ActiveReports.Printing名前空間に属するEndPrintイベントを使用します。
セクションレポートの場合
◆サンプルコード (C#)
private void Form1_Load(object sender, EventArgs e)
{
// レポートをViewerに表示
var sectionReport = new SectionReport1();
sectionReport.Run();
this.viewer1.Document = sectionReport.Document;
// イベントハンドラの設定
sectionReport.Document.Printer.EndPrint += onEndPrint;
}
// 印刷処理の終了時に発生するイベント
private void onEndPrint(object sender, GrapeCity.ActiveReports.Printing.PrintEventArgs e)
{
Console.WriteLine("印刷完了");
}◆サンプルコード (VB.NET)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' レポートをViewerに表示
Dim sectionReport As New SectionReport1
sectionReport.Run()
Me.Viewer1.Document = sectionReport.Document
' イベントハンドラの設定
AddHandler sectionReport.Document.Printer.EndPrint, AddressOf onEndPrint
End Sub
' 印刷処理の終了時に発生するイベント
Private Sub onEndPrint(ByVal sender As Object, ByVal e As GrapeCity.ActiveReports.Printing.PrintEventArgs)
Console.WriteLine("印刷完了")
End Sub
ページレポート/RDLレポートの場合
◆サンプルコード (C#)
private void Form1_Load(object sender, EventArgs e)
{
// レポートをViewerに表示
string file_path = Path.Combine(Application.StartupPath, "PageReport1.rdlx");
var pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_path));
var pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
this.viewer1.LoadDocument(pageDocument);
// イベントハンドラの設定
pageDocument.Printer.EndPrint += onEndPrint;
}
// 印刷処理の終了時に発生するイベント
private void onEndPrint(object sender, GrapeCity.ActiveReports.Printing.PrintEventArgs e)
{
Console.WriteLine("印刷完了");
}◆サンプルコード (VB.NET)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' レポートをViewerに表示
Dim file_path As String = Path.Combine(Application.StartupPath, "PageReport1.rdlx")
Dim pageReport As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(file_path))
Dim pageDocument As New GrapeCity.ActiveReports.Document.PageDocument(pageReport)
Me.Viewer1.LoadDocument(pageDocument)
' イベントハンドラの設定
AddHandler pageDocument.Printer.EndPrint, AddressOf onEndPrint
End Sub
' 印刷処理の終了時に発生するイベント
Private Sub onEndPrint(ByVal sender As Object, ByVal e As GrapeCity.ActiveReports.Printing.PrintEventArgs)
Console.WriteLine("印刷完了")
End Sub