レポートをPDFやExcelなどの形式で出力するには、エクスポートフィルタを使用します。
プロジェクトにエクスポートフィルタを追加するには、以下の2つの方法があります。
フォーム上のコンポーネントデザイナに、エクスポートフィルタのコントロールを配置します。ツールボックスへのコンポーネントの追加方法は「ActiveReportsコントロールを追加する」を参照してください。

| Visual Basic |
コードのコピー
|
|---|---|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim rpt As New SectionReport1
rpt.Run()
Dim ms As New System.IO.MemoryStream
PdfExport1.Export(rpt.Document, ms)
ms.Position = 0
Response.ContentType = "application/pdf"
Response.BinaryWrite(ms.ToArray())
Response.End()
End Sub
|
|
| C# |
コードのコピー
|
|---|---|
protected void Page_Load(object sender, EventArgs e)
{
SectionReport1 rpt = new SectionReport1();
rpt.Run();
System.IO.MemoryStream ms = new System.IO.MemoryStream();
pdfExport1.Export(rpt.Document,ms);
ms.Position = 0;//position stream to 0
Response.ContentType = "application/pdf";
Response.BinaryWrite(ms.ToArray());
Response.End();
}
|
|
| Visual Basic |
コードのコピー
|
|---|---|
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim rpt As New SectionReport1
rpt.Run()
Dim export As New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport
Dim ms As New System.IO.MemoryStream
export.Export(rpt.Document, ms)
ms.Position = 0
Response.ContentType = "application/pdf"
Response.BinaryWrite(ms.ToArray())
Response.End()
End Sub
|
|
| C# |
コードのコピー
|
|---|---|
protected void Page_Load(object sender, EventArgs e)
SectionReport1 rpt = new SectionReport1();
rpt.Run();
GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport export = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
System.IO.MemoryStream ms = new System.IO.MemoryStream();
export.Export(rpt.Document,ms);
ms.Position = 0;//position stream to 0
Response.ContentType = "application/pdf";
Response.BinaryWrite(ms.ToArray());
Response.End();
}
|
|