简体   繁体   English

在运行时将控件添加到RDLC

[英]Adding controls to RDLC at runtime

I need to be able to add all of the user uploaded images to my report dynamically. 我需要能够将所有用户上传的图像动态添加到我的报告中。 I have all of the images stored in one place and I have the name of all the images stored in the database. 我将所有图像存储在一个位置,并且将所有图像的名称存储在数据库中。

Is this possible with an RDLC or would I have to generate a pdf and then insert my images into that with something like iTextSharp? 使用RDLC可以做到这一点吗?还是我必须生成pdf,然后使用iTextSharp之类的图像将其插入其中?

我通过仅生成图像的PDF来解决了此问题,然后将两个PDF与iTextSharp合并。

Yes it is possible. 对的,这是可能的。

  1. In your RDLC add an image 在您的RDLC中添加图像
  2. In the image properties, set the image source to external 在图像属性中,将图像源设置为外部
  3. For the value of the external source point to a field from your dataset which could be something like: MyImageDirectory+NameOfImageFromDatabase.jpg 对于外部源的值,请指向数据集中的字段,例如:MyImageDirectory + NameOfImageFromDatabase.jpg

If you have multiple images to display, use a tablix or a list to list all of them 如果要显示多个图像,请使用Tablix或列表列出所有图像

One more thing: I had to set my path as an URI to make it work. 还有一件事:我必须将路径设置为URI才能使其正常工作。 A string wouldn't work last time I tried. 上次尝试时,字符串不起作用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM