How to display image from Parameter of type byte[]

Tasos SavvaTasos Savva Cyprus
edited 4:36PM in FastReport .NET
Hello

I am trying to pass a logo as a parameter and then show it in the page header of the report. However I could find a way to use that parameter and display the image. I tried using PictureObject but I cannot connect it to a parameter.

Is there a way I can do that?

Comments

  • edited 4:36PM
    .net application
    Image image = Image.FromFile(@"d:\image.jpeg");
    using (FastReport.Report report = new FastReport.Report())
    {
        report.Load(@"d:\untitled.frx");
        report.SetParameterValue("Parameter", image);
        report.Show(true);
    }
    

    script in frx file
    namespace FastReport
    {
      public class ReportScript
      {
    
        private void _StartReport(object sender, EventArgs e)
        {
          Image image = Report.GetParameterValue("Parameter") as Image;
          Picture1.Image = image;
        }
      }
    }
    
  • edited 4:36PM
    HI,
    I've tried this and it doesn't show the image either in the designer or in the preview.

    No error, but no image either.

    My images are being taken from a base64 string stored in a database and converted to an image.
    I can see the image in the VB.net debugger and its fine.

    I can see the parameter in the report and it says its a bitmap.

    But it doesn't show.



  • edited 4:36PM
    Rushl wrote: »
    HI,
    I've tried this and it doesn't show the image either in the designer or in the preview.

    No error, but no image either.

    My images are being taken from a base64 string stored in a database and converted to an image.
    I can see the image in the VB.net debugger and its fine.

    I can see the parameter in the report and it says its a bitmap.

    But it doesn't show.
    Try this :
    in Picture1_BeforePrint Event:
    namespace FastReport
    {
      public class ReportScript
      {
          Picture1_BeforePrint(object sender, EventArgs e)
          {
             Picture1.ImageLocation= Report.GetParameterValue("Parameter") as String;
          }
      }
    }
    

Leave a Comment