Another Image Problem in Crystal Report - GIF images

Last post 07-06-2009 3:39 AM by jeyaseelan@ajsquare.net. 2 replies.

Sort Posts:

  • Another Image Problem in Crystal Report - GIF images

    04-03-2008, 4:48 AM
    • Member
      124 point Member
    • khrizz
    • Member since 02-11-2008, 12:32 PM
    • Posts 38

    HI there.. I'm also having trouble with images in crystal reports for ASP.Net 2005. I have a web appication with crystal report. The report must have a dynamic logo. This image files will be saved as, to the web server and the string path file is the one that has been saved in the database. Here is the generic code that I used...

    <!-- schema file -- >

    <?xml version="1.0" standalone="yes"?>
    <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
     <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:Locale="en-AU">
      <xs:complexType>
       <xs:choice maxOccurs="unbounded">
        <xs:element name="Images">
         <xs:complexType>
          <xs:sequence>
           <xs:element name="path" type="xs:string" minOccurs="0" />
           <xs:element name="image" type="xs:base64Binary" minOccurs="0" />
           <xs:element name="fnCount" type="xs:decimal" />
          </xs:sequence>
         </xs:complexType>
        </xs:element>
       </xs:choice>
      </xs:complexType>
     </xs:element>
    </xs:schema>

    //code behind

    this.DsImages = new DataSet();
    DataTable ImageTable = new DataTable("Images");
    ImageTable.Columns.Add(new DataColumn("path",typeof(string)));
    ImageTable.Columns.Add(new DataColumn("image",typeof(System.Byte[])));
    this.DsImages.Tables.Add(ImageTable);

        FileStream FilStr = new FileStream("myLogofile.jpg", FileMode.Open);
        BinaryReader BinRed = new BinaryReader(FilStr);
            this.DsImages.Tables["Images"].Rows.Clear();
        DataRow dr = this.DsImages.Tables["images"].NewRow();
        dr["path"] = "myLogofile.jpg";
            dr["image"] = BinRed.ReadBytes((int)BinRed.BaseStream.Length);
        this.DsImages.Tables["Images"].Rows.Add(dr);

        FilStr.Close();
        BinRed.Close();

        DynamicImageExample DyImg = new DynamicImageExample();
                   
        DyImg.SetDataSource(this.DsImages);
        this.crystalReportViewer1.ReportSource = DyImg;

     

    With some tweaks, I was been able to show the image in the report by getting the file path from the database. I thought. But when I tried to show another image file, the image was not shown. Only the re X mark can be viewed. I noticed that when the image is gif, crystal reports cannot show the image. Then I tried to add an gif image manually to the report and nothing happens.

    It seems that Crystal reports does not support viewing of gif files? If not,  why Is that so?

    khrizz
  • Re: Another Image Problem in Crystal Report - GIF images

    07-06-2009, 3:17 AM
    • Contributor
      2,730 point Contributor
    • CoolBond
    • Member since 10-25-2007, 1:34 PM
    • Country
    • Posts 535

    Hi,

    Crystal report does not support GIF images as of now. So try with other formats like JPG. try this

    http://natrajt.blogspot.com/2008/06/dynamic-images-at-runtime-in-crystal.html

     

    Hope this will help you....

    " If people criticize you, hurt you, or shout at you,Don't be bothered. Just remember, In every game, audience make the noise, not the players "
  • Re: Another Image Problem in Crystal Report - GIF images

    07-06-2009, 3:39 AM

    Khrizz thanks for your post. Actually crystal report not support with GIF file format so, try to use JPEG files.

    Any doubts please feel free to ask me.

    If this post is answer of your question then don't forgot to Click Mark As Answer.

    Thanks & Regards,
    J.Jeyaseelan
Page 1 of 1 (3 items)