简体   繁体   English

SSRS:Tablix单元格中的外部图像

[英]SSRS: External image in tablix cell

My data set contains a column named IconUri that contains a full HTTP address to an image located on a web server. 我的数据集包含一个名为IconUri的列,其中包含位于Web服务器上的映像的完整HTTP地址。 This data set is bound to a tablix, and I'd like to display the image in a cell. 此数据集绑定到Tablix,我想在单元格中显示图像。

1) I've tried to drag an image into the cell, but I can't use expressions as the image itself isn't aware of its parent's (the tablix) data set. 1)我试图将图像拖入单元格,但我无法使用表达式,因为图像本身不知道其父级(Tablix)数据集。

2) I've also tried to apply the image as a cell background, and while this certainly displays the image, it repeats it in horizontal and vertical direction, which is undesirable. 2)我还试图将图像应用为细胞背景,虽然这肯定显示图像,但它在水平和垂直方向上重复,这是不希望的。 The cell shall contain only one copy of the image. 单元格应仅包含图像的一个副本。

3) I've tried to create a rectangle in the cell, but it will scale to the cell itself and thus the same effect as above. 3)我试图在单元格中创建一个矩形,但它会缩放到单元格本身,因此效果与上面相同。

Is there a way in which this might be done? 有没有办法可以做到这一点? I'm even open to performing some XML hacking if this is what is necessary. 如果这是必要的话,我甚至愿意执行一些XML黑客攻击。 Thank you! 谢谢!

使用Image并在图像属性中将值设置为this = Code.ConvertTotWebUrl(First(Fields!Logo.Value,“dsOrder”))

I solved this problem by examining the XML code that the editor created for the image, and I moved the relevant tag inside the tablix cell and assigned the appropriate bindings. 我通过检查编辑器为图像创建的XML代码解决了这个问题,并且我在tablix单元格中移动了相关标签并分配了适当的绑定。 When I re-opened the editor again, everything fell into place: the image recognizes the data source and compiling as well as rendering works flawelessly. 当我再次重新打开编辑器时,一切都落到了位置:图像识别数据源,编译以及渲染工作都是无懈可击的。

From the toolbox drag an image into your the cell of your tablix: 从工具箱中将图像拖到Tablix的单元格中:

在此输入图像描述

Then right click on the newly added image in the cell and select Image Properties: 然后右键单击单元格中新添加的图像,然后选择图像属性:

在此输入图像描述

Change the image source to External and then pick the dataset field that contains your product URL: 将图像源更改为“外部”,然后选择包含产品URL的数据集字段:

在此输入图像描述

If you get the dreaded red cross instead of an image when you run the report, triple check that the URL actually does point at a publicly available image. 如果在运行报告时遇到可怕的红十字而不是图像,请三次检查URL实际上是否指向公开可用的图像。

If your using a file from the file system rather than an image hosted at a url, you need to ensure the file path is in the form of "file:///C:/RDLCTest/TestImage.png" . 如果您使用文件系统中的文件而不是网址上托管的图像,则需要确保文件路径采用“file:/// C:/RDLCTest/TestImage.png”的形式

If your also displaying the report in the ReportViewer control you will need to turn on EnableExternalImages for the report in code , but that isn't needed if your just outputting the report to say a PDF and downloading it 如果您还在ReportViewer控件中显示报表,则需要在代码中为报表启用EnableExternalImages ,但如果您只是将报表输出为PDF并下载它,则不需EnableExternalImages

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

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