Skip to main content

How to include dynamic Images in Report??????

Comments

1 comment

  • Chris Dunlop

    Bert, here's how I did it.  In my report I have a picture object "picHouse", and an invisible textbox object "txtbox".  The datafield of txtbox is set to the field that contains the photo name.

    Then, in the script tab, I have the following script:

    public void detail_Format()

     

    {

      Picture picHouse = rpt.Sections["detail"].Controls["picHouse"] as Picture;

     

      TextBox txtbox = rpt.Sections["detail"].Controls["txtPhotoName"] as TextBox;

     

      string txtPhoto = txtbox.Text+" ";

     

      txtPhoto=txtPhoto.Trim();

     

      if (txtPhoto == "")

     

      {

     

       txtPhoto="NoPicture";

     

      }

     

      if (txtPhoto == null)

     

      {

     

       txtPhoto="NoPicture";

     

      }

     

      string txtPath = "E:/Latitude Geographics/Geocortex Essentials/Default/REST Elements/Sites/OC_Resources/Images/HistoricPhotos/";

     

      string txtExtension=".jpg";

     

      string txtFinal= txtPath +txtPhoto+ txtExtension;

     

      if  (System.IO.File.Exists(txtFinal) != true)

     

      {

     

          txtFinal= txtPath +"NoPicture"+ txtExtension;

     

      }

     

      picHouse.Image = System.Drawing.Image.FromFile( txtFinal);

     

     

     

    }

     

    Hope this helps.

    Chris

     

    0

Please sign in to leave a comment.