How to display image from Parameter of type byte[]

Tasos SavvaTasos Savva Cyprus
edited 6:34AM 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 6:34AM
    .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 6:34AM
    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 6:34AM
    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

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.