如何将图像添加到报表查看器中? [英] How to add image into Report viewer?

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

问题描述


请帮助解决问题.
我想将图像{动态创建的图表年龄}插入到report(.rdlc report)中.
我可以添加还是不添加?

我已经尝试过此代码,其中我已将图像插入为reportviewer背景.
它显示在表单上,​​但是当我将其导出到 EXCEL或PDF 时,它没有显示.
代码:

Hi,
Please Help to solve the problem.
I want to insert image{Chart age that is created dyanmically} into report(.rdlc report).
Can i add or not?

I have tried this code in which i have inserted image as reportviewer background.
it is shown on form but when i export it to EXCEL Or PDF it is not shown.
Code :

<br />
Report r1 = new Report();//Report is form on which report is generated<br />
                Rectangle rr = new Rectangle(10, 10, 500, 500);<br />
                chart2.SaveImage("Image.bmp", System.Drawing.Imaging.ImageFormat.Bmp);<br />
                Image img = Image.FromFile("Image.bmp");<br />
                Bitmap bb = new Bitmap(img, new Size(100, 100));<br />
                r1.reportViewer1.DrawToBitmap(bb, rr);<br />
                r1.DExpenseTableAdapter.Fill(r1.DealerExpenseDataSet.DExpense);<br />
                r1.reportViewer1.BackgroundImage = img;<br />
                r1.reportViewer1.BackgroundImageLayout = ImageLayout.Center;<br />
                r1.reportViewer1.RefreshReport();<br />
                r1.Show();<br />
                r1.reportViewer1.Show();

推荐答案

我很久以前就使用过报表查看器,MSDN帮了我很多忙.您检查PDF查看器是否接受图像.以我为例(在VS 2005中),它起作用了.您仍然可以检查以下链接


http://msdn.microsoft.com/en-us/library/ms251715 (v = vs.80).aspx [
I used Report viewer a long time back and MSDN helped me a lot. You check the PDF viewer whether that accepts images or not. In my case (With VS 2005) it worked. Still you check the following link


http://msdn.microsoft.com/en-us/library/ms251715(v=vs.80).aspx[^]


好.因此,请编写一个Report Refresh()函数.再打一次.我在gridview中遇到了同样的问题
Ok. So, please write a Report Refresh() function. Call that once again. I faced the same with a gridview


这篇关于如何将图像添加到报表查看器中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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