Setting location of photo from field binding

Posted by: rwatts on 18 August 2020, 9:57 am EST

  • Posted 18 August 2020, 9:57 am EST

    Hello,

    I have a page report that I am working on that needs to display photos. The photos are stored on a file server and are standard png or jpeg. I am setting the complete path and name of the photo in a SQL statement, and setting the “Value” property of the photo in the report to that field. However, when the report runs the photo is not visible. If I hard code the Value property to the path in design time, it does show. But when I try to bind to the path at runtime it is not. Is this functionality supported, and if so is it possible I’m missing something? I do have the Source set to External, and I tried setting the MIMEType as well. I have tried using Active Reports 10 and 13.2, but neither seems to work.

    Thanks!

    Richard

  • Posted 18 August 2020, 8:44 pm EST

    Just to add one more thing, I also tried using a web url instead of a local file location but the report is still not showing the images.

    Thanks!

  • Posted 19 August 2020, 3:22 pm EST

    Hi Richard,

    When you say the images are stored on a file server, what path does the sql statement return? Can you try setting the same field as the Value of a TextBox control instead of the Image control to see the returned path. Please send a screen shot.

    I also tried using a web url in the Value property of the Image control and it worked fine. I have attached a sample report for your reference.

    It would help if you can send across your report to check.

    Thanks

    ImageReport.zip

  • Posted 20 August 2020, 8:34 am EST

    Thanks for your reply! The path being returned by the sql server is going to end up being a network path like ‘\imageserver\test\pic.jpg’. For testing I’m just trying to pull up something from my local machine, like ‘c:\images\pic.jpg’. I tried your sample report as-is but I’m not seeing the image display. I should add though that we are not using the Active Reports image viewer, but instead are rendering the report directly to PDF and displaying that. The basics of that code are below and attached is what I’m trying to accomplish (I left the data source blank and the sql may need tweaking). Thanks again!

    
    using (GrapeCity.ActiveReports.PageReport def = new GrapeCity.ActiveReports.PageReport('c:\photos.rdlx'))
    {
         using (GrapeCity.ActiveReports.Document.PageDocument runTime = new GrapeCity.ActiveReports.Document.PageDocument(def))
         {
             GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdf = new  
             GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
             runTime.Render(pdf, fs, settings);
          }
      }
    }
    
    
  • Posted 21 August 2020, 4:31 am EST

    Hello,

    I am not able to reproduce the issue at my end. Please refer to the attached report. Could you please check with the attached report. If issue is not reproducible with attached report at your end then could you please share your own report.

    Thanks,

    Mohit

    Untitled.zip

  • Posted 26 August 2020, 9:31 am EST

    Hi Mohit,

    Thanks for your help, I finally figured out the issue. Your example worked fine, but in my program it didn’t work. I finally realized I was using a custom resource class to handle subreports, and it wasn’t returning information if images were passed in. I have it working now.

    Thanks!

  • Posted 27 August 2020, 1:39 am EST

    Hello,

    I am assuming that everything is working well now. Please feel to revert back if you have any additional question.

    Thanks,

    Mohit

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels