[]
ActiveReportsでは、Printメソッドを使用してレポート(セクションレポート、ページレポート、RDLレポート)を印刷します。
Printメソッドには、以下のいずれかの方法でアクセスできます。
Viewer.Printメソッドを使用する
SectionDocumentクラスまたはPageDocumentクラスから、Printメソッドを使用する
(1)Viewer.Printメソッドを使用する
標準の印刷方法です。ViewerクラスのPrintメソッドを使用し、Viewerコントロール上にあるレポートを印刷します。印刷処理を実行する前に、レポートが完全にロードされていることを確認してください。
Visual Basic
Viewer1.Print(True, True, True)C#
viewer1.Print(true, true, true);(2)SectionDocumentクラスまたはPageDocumentクラスから、Printメソッドを使用する
SectionDocumentクラスまたはPageDocumentクラスから、Printメソッドを使用します。
セクションレポート
Visual Basic
Imports GrapeCity.ActiveReportsDim rpt = New SectionReport1()
rpt.Run()
Dim sectionDocument As Document.SectionDocument = rpt.Document
sectionDocument.Print(True, True, False)C#
using GrapeCity.ActiveReports;var rpt = new SectionReport1();
rpt.Run();
GrapeCity.ActiveReports.Document.SectionDocument sectionDocument = rpt.Document;
sectionDocument.Print(true, true, false);ページレポート/RDLレポート
Visual Basic
Imports GrapeCity.ActiveReportsDim file_name As String = "..\..\PageReport1.rdlx"
Dim pageReport As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(file_name))
Dim pageDocument As New GrapeCity.ActiveReports.Document.PageDocument(pageReport)
pageDocument.Print(True, True, False)C#
using GrapeCity.ActiveReports;string file_name = @"..\..\PageReport1.rdlx";
GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(file_name));
GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
pageDocument.Print(true, true, false);このPrintメソッドは、MESCIUS.ActiveReports.Viewer.CommonアセンブリのGrapeCity.ActiveReports名前空間にあるPrintExtension.Printメソッドの拡張メソッドとして実装されています。そのため、SectionDocumentクラスまたはPageDocumentクラスからPrintメソッドにアクセスするには、プロジェクトにMESCIUS.ActiveReports.Viewer.Commonへの参照を追加する必要があります。また、上記サンプルコードのように、Imports(Visual Basic .NET)、または、using(C#)ステートメントを使用して、GrapeCity.ActiveReports名前空間を参照する必要があります。
(3)PrintExtensionクラスのPrintメソッドを使用する
PrintExtensionクラスのPrintメソッドを使用して、Viewerコントロールに読み込まれたレポートを印刷できます。印刷を実行する前に、レポートが読み込まれていることを確認してください。以下のコードサンプルは、PrintExtensionクラスのPrintメソッドを使用して印刷する方法です。
セクションレポート
Visual Basic
Imports GrapeCity.ActiveReportsGrapeCity.ActiveReports.PrintExtension.Print(sectionDocument, True, True)C#
using GrapeCity.ActiveReports;GrapeCity.ActiveReports.PrintExtension.Print(sectionDocument, true, true);ページレポート/RDLレポート
Visual Basic
Imports GrapeCity.ActiveReportsGrapeCity.ActiveReports.PrintExtension.Print(pageDocument, True, True)C#
using GrapeCity.ActiveReports;GrapeCity.ActiveReports.PrintExtension.Print(pageDocument, true, true);このPrintメソッドは、MESCIUS.ActiveReports.Viewer.CommonアセンブリのGrapeCity.ActiveReports 名前空間にあるPrintExtension.Printメソッドの拡張メソッドとして実装されています。
SectionDocumentクラスまたは PageDocumentクラスからPrintメソッドにアクセスするには、プロジェクトにGrapeCity.ActiveReports参照を追加する必要があります。
Winビューワの描画エンジンはデフォルトでDirect2Dが選択されています。Direct2Dは、パフォーマンスの向上、最新のベクター レンダリングを提供し、GDIドライバに依存しません。アプリケーションがGDI固有の設定に依存している場合、描画エンジンをGDIに切り替える必要があります。切り替える方法は変更点を参考に設定ファイルを作成してご利用ください。