Image is the format that converts your report to an image file. You can use the ImageRenderingExtension to your render you report in this format. Make sure that you select an ImageType to any of the six different image formats available: BMP, EMF, GIF, JPEG, TIFF, and PNG.
To render the entire report as a single image, set the Pagination setting to False.
The following steps provide an example of rendering a report in Image format.
Visual Basic.NET code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
' 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# code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
// 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 offers several options to control how reports render to Image.
Property | Description |
---|---|
Compression | Sets or returns a value which specifies the compression to be used when exporting. |
Dither | Specifies whether the image should be dithered when saving to a black and white output format, like CCITT3 or Rle. This property has no effect if the CompressionScheme property is set to Lzw or None(represents color output). |
DpiX | Adjust the horizontal resolution of rendered images. The default value is 96. |
DpiY | Adjust the vertical resolution of rendered images. |
EndPage | The default value of 0 in this property renders all of the report pages. Otherwise, set this value to the number of the last page to render. Please note that if the StartPage property is set to 0, all of the pages of the report render. In order to use the EndPage property, you must set the StartPage property to a valid non-zero number. |
ImageType | Select the type of image to which you want to render the report. Supported types are BMP, EMF, GIF, JPEG, TIFF, and PNG. |
MarginBottom | Set the value in inches to use for the bottom margin of the image. The format is an integer or decimal with "in" as the suffix, for example "1in" for 1 inch. By default, no margins are used. The value set in this property overrides the report's settings. |
MarginLeft | Set the value in inches to use for the left margin of the image. The format is an integer or decimal with "in" as the suffix, for example "1in" for 1 inch. By default, no margins are used. The value set in this property overrides the report's settings. |
MarginRight | Set the value in inches to use for the right margin of the image. The format is an integer or decimal with "in" as the suffix, for example "1in" for 1 inch. By default, no margins are used. The value set in this property overrides the report's settings. |
MarginTop | Set the value in inches to use for the top margin of the image. The format is an integer or decimal with "in" as the suffix, for example "1in" for 1 inch. By default, no margins are used. The value set in this property overrides the report's settings. |
PageHeight | Set the value in inches to use for the height of the image. The format is an integer or decimal with "in" as the suffix, for example "11in" for 11 inches. The value set in this property overrides the report's settings. |
PageWidth | Set the value in inches to use for the height of the image. The format is an integer or decimal with "in" as the suffix, for example "11in" for 11 inches. The value set in this property overrides the report's settings. |
Pagination | By default, each page of a report is rendered as a separate image. Set this value to False to render the entire report as a single image. |
PrintLayoutMode |
Select how to lay out the pages of the report in the image.
|
Quality | Gets or sets the quality of the report to be rendered as an image. |
SizeToFit | By default, rendered report pages are not resized to fit within the selected image size. Set this value to True to resize the report pages. |
Start Page | The default value of zero in this and the EndPage properties render all of the report pages to images. Otherwise, set this value to the number of the first page to render. |
WatermarkAngle | Specify the degree of angle for the watermark text on the image. Valid values range from 0 to 359, where 0 is horizontal, left to right. |
WatermarkColor | Select a color for the watermark text on the image. The default value for the watermark color is gray, but you can select any Web, System, or Custom color. |
WatermarkFont | Set the font to use for the watermark to any valid System.Drawing.Font. |
WatermarkTitle | Sets text (i.e. CONFIDENTIAL) to use as the watermark on the image. |
Reports rendered as images do not support any of the interactive features of Data Dynamics Reports. Any data hidden at the time of export is hidden in the image. To display all data in a drill-down report, expand all toggle items prior to exporting.