Insert dynamic images into the crystal report page from the image folder

Is there a way to dynamically insert images into a Crystal Reports page from an image folder?

The exact requirement is to display the company logo at the top of each page of the crystal report and when they change, that is, when you have a new logo, you change the image (.jpg) only in the image folder and the corresponding image in all reports should change.

How to do it in C #?

+5
source share
2 answers

I am posting the answer that I have, hope it will be useful to others.

private void getImage()
    {
        FileStream fs;
        fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + "img\\cube.png", FileMode.Open);
        BinaryReader BinRed = new BinaryReader(fs);
        try
        {
            CreateTable();
            DataRow dr = this.DsImages.Tables["images"].NewRow();
            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;
        }
        catch (Exception er)
        {
            MessageBox.Show(er.Message, "Error");
        }
    }
+1
source

CR : . " " β†’ "" β†’ " ", .

0

All Articles