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

图像是将报告转换为图像文件的格式。 您可以使用ImageRenderingExtension以这种格式报告您的渲染。 确保您从可用的六种不同图像格式中选择一种ImageType:BMP,GIF,JPEG,TIFF和PNG。

注意:默认情况下,图像渲染扩展为报告中的每个页面创建一个单独的文件,并为每个对应的文件名添加索引(例如image001.PNG,image002.PNG等)。
要将整个报告呈现为单个图像,请将分页设置设置为False。

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

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

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

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

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

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

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

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


' Provide the page report you want to render.
Dim report As New GrapeCity.ActiveReports.PageReport()
Dim reportDocument As New GrapeCity.ActiveReports.Document.PageDocument(report)

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

' Provide settings for your rendering output.
Dim imageSetting As New GrapeCity.ActiveReports.Export.Image.Page.Settings()
Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = imageSetting

' Set the rendering extension and render the report.
Dim imageRenderingExtension As New GrapeCity.ActiveReports.Export.Image.Page.ImageRenderingExtension()
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

reportDocument.Render(imageRenderingExtension, outputProvider, imageSetting)


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


// Provide the page report you want to render.
GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport();
GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);

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

// Provide settings for your rendering output.
GrapeCity.ActiveReports.Export.Image.Page.Settings imageSetting = new GrapeCity.ActiveReports.Export.Image.Page.Settings();
GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = imageSetting;

// Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Image.Page.ImageRenderingExtension imageRenderingExtension = new GrapeCity.ActiveReports.Export.Image.Page.ImageRenderingExtension();
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;

reportDocument.Render(imageRenderingExtension, outputProvider, imageSetting);




相关资源:


注意

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

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

ActiveReports 官方技术交流群:109783140

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

  • No labels