Posts

Showing posts from October, 2015

How to set dynamically height/width of an external image in rdlc report?

It seems that there is no way to dynamically set the height and width of an external image used in rdlc report, but here a workaround to make it possible Add image to you Report On the image properties, set it to use External image source and use a report parameter to set which image to use On image, set "keep original size" Edit: You may also generate such "padding image" dynamically to allow different widths, for example: public void GenerateReport(int width, int height) { var image =Bitmap.FromFile("your image path"); //you can use stream or other way to get the image using (var g = Graphics.FromImage(image)) { g.Clear(Color.Transparent); g.FillRectangle(new SolidBrush(Color.Transparent), 0, 0, width, height); // here will change the size to fit in report } MemoryStream ms = new MemoryStream(); image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); // and pa