How to pass image in crystal report
Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Writing Code
Forum Discription: .NET 2003 programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=16437
Printed Date: 01 May 2024 at 10:26pm
Topic: How to pass image in crystal report
Posted By: umesh.chape
Subject: How to pass image in crystal report
Date Posted: 15 May 2012 at 10:58pm
Hi ,
How to pass image in crystal report . ?
I tried like this .
rpt.DataDefinition.FormulaFields[15].Text = "C:\\Documents and Settings\\My Documents\\My Pictures\\Photo.jpg"
But it is not working .
Please help me .
|
Replies:
Posted By: nmathur
Date Posted: 24 Jul 2012 at 11:21pm
Hello Umesh,
I know your post is old, but I am posting the solution which wored for me so that it can be useful for others.
I got similar code here http://scn.sap.com/docs/DOC-6093 - http://scn.sap.com/docs/DOC-6093 and modified it according to my requirement.
This is the code, hope this will help: CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument =
new CrystalDecisions.CrystalReports.Engine.ReportDocument(); ISCDReportClientDocument reportClientDocument;
CrystalDecisions.ReportAppServer.ReportDefModel.Section mySection;
CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject myPicture;
//load the main report reportDocument.Load(Server.MapPath("CrystalReport.rpt"));
//cast it as a reportclientdocument reportClientDocument = reportDocument.ReportClientDocument;
//grab the specific section of the report that we want to put the picture in mySection = reportClientDocument.ReportDefController.ReportDefinition.ReportHeaderArea.Sections[0];
//import the picture object into the main report myPicture =
reportClientDocument.ReportDefController.ReportObjectController.ImportPicture(Server.MapPath("nm.jpg"),
mySection, 1, 1); //view the report CrystalReportViewer1.ReportSource = reportDocument;
You can get more samples from here: http://wiki.sdn.sap.com/wiki/display/BOBJ/NET+RAS+SDK+Samples - http://wiki.sdn.sap.com/wiki/display/BOBJ/NET+RAS+SDK+Samples
Thanks, NMathur
------------- NMathur
|
|