有条件地将图像绑定到RDLC页面 [英] Conditonally bind images to RDLC pages

查看:82
本文介绍了有条件地将图像绑定到RDLC页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑到这样一种情况,我将许多来自不同商店的发票打印到PDF文档中.

我用8张图像(这些是商店徽标)初始化图像包装器对象,然后将其动态分配给报表RDLC.但是问题是我在每个发票页面上都得到了相同的图像.

我在数据集中得到了storeId,是否可以根据发票的storeid将商店图像分配给这些页面,以便根据商店区分发票?

我尝试使用以下代码(后面是RDLC代码,通过附加了程序集)

Considering the scenario where I print a number of invoices coming from different stores to a PDF document.

I initialize an image wrapper object with say 8 images (these are store logos) and dynamically it gets assigned to the report RDLC. But the issue is I get same image in every invoice page.

I get the storeId in the dataset, is it possible to assign store images to these pages depending on the storeid of the invoice, in order to distinguish invoices according to stores?

I tried with the following code (RDLC Code behind, by attaching the assembly)

Public Function StoreImage(Storeid as Integer) as Byte()
	Try
		Return eCom.Handlers.LogoWrapper.GetImage(StoreId);
	Catch ex As Exception
		Return ex.Message
	End Try
End Function



请在这方面指导我.

谢谢.



Kindly guide me in this regard.

Thanks.

推荐答案

你好,
请查看该解决方案是否适合您-
我假设您正在使用网站打印发票.
a)将所有徽标图像放入您的站点文件夹中,以便有图像的URL
b)为图片网址添加报告参数(例如,假设该参数为ImagePath)
c)在RDLC中针对图像集Source = External和Value = Parameters!ImagePath.Value
d)在后面的代码中,使用Reportviewer.LocalReport.SetParameters设置"ImagePath"报告参数.

希望这会有所帮助.
Hello,
please see if this solution works for you -
I am assuming that you are using a web site to print invoices.
a) place all the logo images into your site folder, so that you have URLs for images
b) add a report parameter for the image URL (for eg. say the parameter is ImagePath)
c) in RDLC for the image set Source=External and Value=Parameters!ImagePath.Value
d) in the code behind, use Reportviewer.LocalReport.SetParameters to set the "ImagePath" report parameter.

Hope this helps.


这篇关于有条件地将图像绑定到RDLC页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆