How to show images on an RDLC report

前端 未结 2 1875
悲哀的现实
悲哀的现实 2021-02-15 00:44

I have an RDLC report and would like one of the columns in a table on this report to display images. The datasource for my report is a class that has a property called Image of

2条回答
  •  [愿得一人]
    2021-02-15 01:12

    I don't know if this is the best solution, but I got it to work. It looks like the problem was in using System.Drawing.Image.

    In my class, I created a new property called ImageByte of type byte[]. I didn't make a setter for ImageByte, but I made a getter that does the following:

    MemoryStream ms = new MemoryStream();
    Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
    return ms.ToArray();
    

    I updated my report to have =Fields!ImageByte.Value for the Value and now everything appears to be working as expected :o)

提交回复
热议问题