Hi,
I try to insert external image in RDLC report. I'm using a business object as follow :
class businessObject { public string Text { get; set; } public int Value { get; set; } public Image Piture { get; set; } public string PictureLoc { get; set; } public businessObject(string text, int val,string pictureLocation) { Text = text; Value = val; PictureLoc = pictureLocation; Piture = Image.FromFile(PictureLoc); } }
My report is a simple report displaying on each page the text the value and the picture of each business object. I define on the rdlc an Image object with properties Source=External, Value=Fields!Picture.value, MIMEType=image/png.
I inserted a report viewer in my base form and code the form as follow :
public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { reportViewer1.LocalReport.EnableExternalImages = true; for (int i = 1; i < 4; i++) businessObjectBindingSource.Add(new businessObject("Test " + i.ToString(), i, "d:\\Users\\Admin\\Desktop\\Icon\\validate.png")); this.reportViewer1.RefreshReport(); } }
But unfortunately when I run the code text and values are well displayed but not the image (little sqare with red cross), any idea why ?
Thanks in advance for your help.
Rgds Pascal.