在报告中包含未知数量的外部图像?
我正在构建一个需要包含照片的报告,我无法知道将拍摄多少张照片,但它们存储在文件服务器上,位于以生成的报告 ID 命名的文件夹下。 我该如何将这些内容包含在 RDLC 中?
I am building a report that needs to include photographs, I have no way of knowing how many photos will be taken but they are stored on a file server under folder named after the ID of the report being generated. How would I go about including these in an RDLC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您知道数量和文件名,则在报告中包含图像很简单: MSDN 如何:添加图像(图像向导)
但在您的情况下,如果您不知道应显示多少图像,您可以选择:
- 将图像文件名保存在数据库中并使用报告中的sql选择它们
或
- 创建 Web 服务以从目录中收集图像文件名并将其作为数据源传递到报告中。 报表服务:使用 XML 和 Web 服务数据源
接下来是报表使用表或列表,将图像放在那里并从数据源字段设置图像的 url/路径。
It's simple to include images in report if you know quantity and filenames: MSDN How to: Add an Image (Image Wizard)
But in your case if you don't know how many images should be displayed, you have options:
- save image file names in DB and select them with sql from report
or
- create web service to gether image file names from directory and pass it in report as a datasource. Reporting Services: Using XML and Web Service Data Sources
Next in report use Table or List, place Image there and set url/path to Image from datasource field.
我是一名 PHP 人员,所以我的答案需要进行过滤,但在 PHP 中,您需要进行目录读取,然后检查目录中的每个文件,以确保它是适合包含的图像类型。
打开目录()
readdir()
和 a for a while 循环来检查文件扩展名以确保仅包含图像。
I'm a PHP guy so my answer needs to be filtered, but in PHP you'd do a directory reading and then review each file in the directory to make sure it was a suitable image type for including.
opendir()
readdir()
and the a for a while loop to review the file name extensions to make sure you're including only images.