ActiveReports 18 .NET Edition
Developers / Export Reports / Export Page/RDLX Reports / Image Export
In This Topic
    Image Export
    In This Topic

    Image is the format that converts your report to an image file. You can use the ImageRenderingExtension to render your report in this format. Make sure that you select an ImageType to any of the six different image formats available: BMP, GIF, JPEG, TIFF, and PNG.

    Note: By default, the image rendering extension creates a separate file for each page in a report and adds an index to each corresponding file name (for example, image001.PNG, image002.PNG, etc).

    To render the entire report as a single image, set the Pagination setting to False.

    Image Rendering Properties

    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.
    ImageType Select the type of image to which you want to render the report. Supported types are BMP, GIF, JPEG, TIFF, and PNG.
    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.  
    Quality Gets or sets the quality of the report to be rendered as a JPEG image.

    Export Report using Image Rendering Extension

    Reports rendered as images do not support any of the interactive features of Active 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.

    The following steps provide an example of rendering a report in Image format.

    1. Create a new Visual Studio project.
    2. In the New Project dialog that appears, select ActiveReports 18 Page report Application and specify a name for the project in the Name field.
    3. Click OK to create a new ActiveReports 18 Page report Application. By default, a Page report is added to the project.
    4. Add a reference to MESCIUS.ActiveReports.Export.Image package in the project.
    5. On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
    6. Add the following code inside the Form_Load event.
    Visual Basic.NET code. Paste INSIDE the Form Load event.
    Copy Code
    ' 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:\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
    
    pageReport.Document.Render(imageRenderingExtension, outputProvider, imageSetting)
    
    C# code. Paste INSIDE the Form Load event.
    Copy Code
    // 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:\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;
    
    pageReport.Document.Render(imageRenderingExtension, outputProvider, imageSetting);