将字节图像添加到RDLC报告中 [英] Add byte image to RDLC report

查看:67
本文介绍了将字节图像添加到RDLC报告中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个字节图像,我试图在我的report.rdlc中设置它。

有人能告诉我怎么做吗?



我有以下代码:

I have a byte image and im trying to set it in my report.rdlc.
Can somebody tell me how to do this?

I have the following code:

DataTable dtDS = ds.Tables["tblDS"];
                    if (dtDS.Rows.Count != 0)
                    {
                        DataRow dr = dtDS.Rows[0];
                        HTMLConverter rtf = new HTMLConverter();

                        ReportViewer viewer = new ReportViewer();                       
                        LocalReport lr = viewer.LocalReport;
                        lr.ReportPath = ConfigUtil.GetAppSetting("DataSheetType_" + dr["DataSheetType"].ToString());
                        ReportDataSource rds = new ReportDataSource();
                        rds.Value = ds.Tables[0];
                        rds.Name = "report";
if (dr["ProcessImage"] == DBNull.Value)
{
   ReportDataSource ImageReport = new ReportDataSource();
   ImageReport.Name = "LogoDS";
   ImageReport.Value = dr["ProcessImage"];
   lr.DataSources.Add(ImageReport);                            
}
}





如何将此ReportDataSource图像添加到我的报告中?



How can i add this ReportDataSource image to my report?

推荐答案

将图像转换为二进制。



Convert image to binary.

byte[] imgBinary=File.ReadAllBytes(rootPath + "FOLDER\\IMAGE.JPG");





2.添加报告图像框并将其绑定到此属性



设置EnableExternalImages = true



2.add image box to the report and bind it to this property

Set EnableExternalImages=true


这篇关于将字节图像添加到RDLC报告中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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