title: Changing/adding images dynamically in Crystal Reports in ASP.NET
body: <p>I'm working on the reporting section of an ASP.NET MVC web application, where users can change the parameters of a Crystal Report and download the resulting report file. Each report template that we use has a logo at the top but I need to change the graphic location dynamically (the graphic location is hard-coded in the image object but the url it uses is no longer available, hence why I need to change it dynamically).</p>
  
  <p>I found several solutions suggesting the use of a formula as the graphic location and changing that in the code when generating a report, but this is not viable because I would have to manually change 150+ .rpt files. What I really need is to somehow access the graphic location property of the image object.</p>
  
  <p>I'm converting an old VB6 control that used to do this:</p>
  
  <pre><code>Private Sub gCurrentSection_Format(ByVal pFormattingInfo As Object)
      Dim logoImage As StdPicture
      Set logoImage = LoadPicture("...\logo.jpg")
      Set gLogo.FormattedPicture = logoImage
  End Sub
  </code></pre>
  
  <p>where gLogo is the image object (the type is CRAXDRT.crOleObject). This object was found by looping through all the sections and report objects in the report until the image was found.</p>
  
  <p>I'm using Crystal Reports for .NET Framework 4.0 (version 13.0.2000.0) and the rpt files are using CR 2008.</p>
  
  <p>Is there any way I can access the graphic location property of my object without having to alter the report files?</p>
  
  <p>EDIT: I've done a lot of googling and it seems you can't access the "graphic location" property in code. I figured out how to suppress the logo in code, though, so my question now is how do I ADD a new image dynamically to a section? All the articles I found online suggest adding the image itself as binary data to my datasource, which again I cannot do without changing the reports. Any suggestions?</p>