如何使用ASP.Net和C sharp动态地将图像从本地驱动器加载到水晶报表中? [英] how to dynamicaly load an image from local drive into crystal report using ASP.Net and C sharp?

查看:68
本文介绍了如何使用ASP.Net和C sharp动态地将图像从本地驱动器加载到水晶报表中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题需要加载图片作为水晶报告的Logo及其位置路径:



我遵循以下步骤:



1.在报告中创建一个字符串参数并将其命名为'PicPath'

2.插入一个OLE对象(插入菜单 - OLE对象)

3.您将看到一个新窗口。在其中,选择从文件创建选项 - 浏览任何图片文件() - 单击确定step1.JPG

4.单击确定。根据您的设计将此OLE对象放在报表/页眉中

5.右键单击OLE对象 - >选择'格式图形'

6.选择'图片选项卡'(见图2)step2.JPG

7.在图形位置点击'公式编辑器'按钮。

您将获得一个新的公式编辑窗口。

8.您可以在报告字段下看到参数Pic Path拖动它step3.JPG

检查公式中的任何错误。



我从这里得到了以下步骤:http://social.msdn.microsoft.com/Forums/en-US/f869fe3f-ee0f-4ecd-ae7c-9303e0b1f66f / dynamic-image-location-by-using-a-parameter



后端我正在使用此代码:



CrystalDecisions.CrystalReports.Engine.ReportClass clsReport = new CrystalDecisions.CrystalReports.Engine.ReportClass();

clsReport.SetParameterValue(2,D:\\mypc \ \ NEWW_Images \\client-logo.bmp);



但是每当我试图运行项目时,当我点击查看时它会给我错误那个报告。报告中写着图像而不是图像。请指导我在这里做错了什么。我迫切需要这个。



提到我使用Asp.net和C sharp来查看报告。水晶报告XI。



谢谢。

I am having some problem to load picture which is a Logo to the crystal report with its Location Path:

I am following these steps:

1. create a string parameter in the report and name it 'PicPath'
2. insert an OLE Object (insert menu - OLE Object)
3. You will get a new window. in that, select the option for 'Create from file' - browse for any picture file () - click on OK step1.JPG
4.Click on Ok. Place this OLE Object in Report / Page Header according to your design
5.Right click on the OLE Object -> select 'Format Graphics'
6.Select 'Picture Tab' (see fig 2) step2.JPG
7.on the Graphic Location click on 'Formula Editor' button.
you will get a new formula editing window.
8.you can see the parameter 'Pic Path' under the 'Report Fields' drag it step3.JPG
check for any errors in the formula.

I got these steps from here: http://social.msdn.microsoft.com/Forums/en-US/f869fe3f-ee0f-4ecd-ae7c-9303e0b1f66f/dynamic-image-location-by-using-a-parameter

in the back end I am using this code:

CrystalDecisions.CrystalReports.Engine.ReportClass clsReport = new CrystalDecisions.CrystalReports.Engine.ReportClass();
clsReport.SetParameterValue(2, "D:\\mypc\\NEW_Images\\client-logo.bmp");

but everytime I am trying to run the project it is giving me error when I click to view the report. And the report is coming with written word "Image" instead of the image. Please guide me what I am doing wrong here. I really need this urgently.

mentioned that I am using Asp.net and C sharp to view the report. And crystal report XI.

Thank you.

推荐答案

查看我过去的答案。

在水晶报告中显示图像 [ ^ ]
Check this my past answers on this.
Showing image in crystal report[^]


这篇关于如何使用ASP.Net和C sharp动态地将图像从本地驱动器加载到水晶报表中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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