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:37AM
    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:37AM
    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:37AM
    write your filename in fastreport tags, look at designer, menu report=>options=>description, then access it via code

Leave a Comment