在rdlc报告查看器上显示图像 [英] Display image on rdlc report viewer

查看:99
本文介绍了在rdlc报告查看器上显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我在rdlc(Microsoft Report Viewer)报告中显示图像时出现问题。我在我的报告上拍了照片框,并将其属性设置为SOURCE = EXTERNAL,VALUE = Parameters!Path.value其中Path是我的报告参数。



下面是代码在报告加载事件上显示图像:



 Dim paramList1 As New Generic.List(Of ReportParameter)
paramList1.Add(New ReportParameter(Path,+ / images / CPC.jpg))Me.ReportViewer1.LocalReport.SetParameters(paramList1)





我在我的代码的第二行面临问题,即+ / images / CPC.jpg



Plz帮助我,我被困在这里。 />


以下是错误:



从字符串/images/CPC.jpg转换为'Double '无效。



谢谢

解决方案

  Dim  arrPic  as   byte ()= ' 将图像加载为字节数组 
' 将byte()转换为BASE64
Dim sIMGBASE64 as String = Convert.ToBase64String(arrPic))
' 添加BASE64流到参数
paramList1.Add( ReportParameter(< sparamname>,sIMGBASE64)



其中

sParamName是报告的参数



在报告中设置Picture Box的Value属性这个:

 Value = System.Convert.FromBase64String(参数!< sparamname> .Value)


确保在图像路径前面添加

File:///



并在您创建的报告参数中为道路,使苏它是类型字符串,而不是double或整数


你的代码在VB.net中所以使用&而不是+....可能是这个问题

Hi,

I've problem in displaying image on my rdlc (Microsoft Report Viewer) report. I took picture box on my report and made its properties as SOURCE=EXTERNAL, VALUE=Parameters!Path.value where Path is my Report Parameter.

Below is the code to display image on Report load event:

Dim paramList1 As New Generic.List(Of ReportParameter)
paramList1.Add(New ReportParameter("Path", "+ /images/CPC.jpg"))       Me.ReportViewer1.LocalReport.SetParameters(paramList1)



I'm facing problem on the second line of my code i.e. " + /images/CPC.jpg"

Plz help me, I'm stuck here.

Following is the error:

Conversion from string " /images/CPC.jpg" to type 'Double' is not valid.

Thanks

解决方案

Dim arrPic as byte() = 'Load the image as array of byte'
'Convert byte() to BASE64
Dim sIMGBASE64 as String = Convert.ToBase64String(arrPic))
'Add the BASE64 stream to the parameters
paramList1.Add(New ReportParameter(<sparamname>, sIMGBASE64)


where
sParamName is a parameter of the Report

On the Report set the "Value" property of Picture Box like this:

Value=System.Convert.FromBase64String(Parameters!<sparamname>.Value)


make sure you add

"File:///"

in front of the image path
and in the report parameter you created for Path, make sure it is of type string, and not double or integer


your code is in VB.net so use " & " instead of " + " .... may be that is the problem


这篇关于在rdlc报告查看器上显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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