create image report

Hi,
How i can create an image (.jpg) report and save it in specific path without using report previewr editor , i need that from inside program code

quick response please

thanks

Comments

  • edited April 2017
    using (FastReport.Report report = new FastReport.Report())
    {
        report.Load("report.frx");
        report.RegisterData(datatable, datatable.TableName);
        report.Prepare();
        using (FastReport.Export.Image.ImageExport image = new FastReport.Export.Image.ImageExport())
        {
            image.ImageFormat = FastReport.Export.Image.ImageExportFormat.Jpeg;
            image.SeparateFiles = false;
            image.Resolution = 300;
            report.Export(image, "image.jpg");
        }
    }
    
  • edited 3:16PM
    ipong wrote: »
    using (FastReport.Report report = new FastReport.Report())
    {
        report.Load("report.frx");
        report.RegisterData(datatable, datatable.TableName);
        report.Prepare();
        using (FastReport.Export.Image.ImageExport image = new FastReport.Export.Image.ImageExport())
        {
            image.ImageFormat = FastReport.Export.Image.ImageExportFormat.Jpeg;
            image.SeparateFiles = false;
            image.Resolution = 300;
            report.Export(image, "image.jpg");
        }
    }
    


    Thank you it is now working well , but here a simple question that what happen when there are more than one pages.

    thanks
  • edited April 2017
    image.SeparateFiles = false => all pages exported into one image file, try it...
  • edited 3:16PM
    ipong wrote: »
    using (FastReport.Report report = new FastReport.Report())
    {
        report.Load("report.frx");
        report.RegisterData(datatable, datatable.TableName);
        report.Prepare();
        using (FastReport.Export.Image.ImageExport image = new FastReport.Export.Image.ImageExport())
        {
            image.ImageFormat = FastReport.Export.Image.ImageExportFormat.Jpeg;
            image.SeparateFiles = false;
            image.Resolution = 300;
            report.Export(image, "image.jpg");
        }
    }
    

    Thanks it is now working well , but an other question that i want to save report image with report name , all possible trys used (Extracting file name without extension and append with .jpg) but no way

    how to do that

    thanks
  • edited 3:16PM
    write your filename in fastreport tags, look at designer, menu report=>options=>description, then access it via code

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.