Page tree
Skip to end of metadata
Go to start of metadata

便携式文档格式(PDF)是建议用于打印和保留格式的格式。您可以使用PDFRenderingExtension以这种格式呈现报告。借助PDF呈现扩展,您可以使用诸如字体链接,数字签名和最终用户定义的字符(EUDC)之类的功能。这些功能仅在ActiveReports专业版中可用。

以下步骤提供了以PDF格式呈现报告的示例。

1、创建一个新的Visual Studio项目。

2、在出现的“新建项目”对话框中,选择“ ActiveReports 14页面报表应用程序”,然后在“名称”字段中指定项目的名称。

3、单击“确定”创建一个新的ActiveReports 14页面报表应用程序。默认情况下,页面报告将添加到项目中。

4、在项目中添加对GrapeCity.ActiveReports.Export.Pdf包的引用。

5、在打开的Form.cs或Form.vb上,双击标题栏以创建Form_Load事件。

6、在Form_Load事件中添加以下代码。
 

Visual Basic.NET代码。粘贴到Form Load事件中。


' Provide the page report you want to render.
Dim rptPath As New IO.FileInfo("..\..\PageReport1.rdlx")
Dim pageReport As New GrapeCity.ActiveReports.PageReport(rptPath)

' Create an output directory.
Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyPDF")
outputDirectory.Create()

' Provide settings for your rendering output.
Dim pdfSetting As New GrapeCity.ActiveReports.Export.Pdf.Page.Settings()

' Set the rendering extension and render the report.
Dim pdfRenderingExtension As New GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension()
Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))

' Overwrite output file if it already exists
outputProvider.OverwriteOutputFile = True

pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting)


C#代码。 粘贴到Form Load事件中。


// Provide the page report you want to render.
System.IO.FileInfo rptPath = new System.IO.FileInfo(@"..\..\PageReport1.rdlx");
GrapeCity.ActiveReports.PageReport pageReport = new GrapeCity.ActiveReports.PageReport(rptPath);

// Create an output directory.
System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyPDF");
outputDirectory.Create();

// Provide settings for your rendering output.
GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();

// Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));

// Overwrite output file if it already exists
outputProvider.OverwriteOutputFile = true;

pageReport.Document.Render(pdfRenderingExtension, outputProvider, pdfSetting);




相关资源:


注意

如需寻求在线帮助,请访问 ActiveReports 求助中心

如需了解更多ActiveReports产品特性,请访问 ActiveReports 官方网站

ActiveReports 官方技术交流群:109783140

下载产品体验产品功能:http://www.gcpowertools.com.cn/products/download.aspx?pid=16

  • No labels