Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: How to pass image in crystal report Post Reply Post New Topic
Author Message

Joined: 12 May 2011
Online Status: Offline
Posts: 11
Quote umesh.chape Replybullet Topic: How to pass image in crystal report
    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 .
IP IP Logged

Joined: 18 Jul 2012
Location: India
Online Status: Offline
Posts: 2
Quote nmathur Replybullet 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 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

        //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:


Edited by nmathur - 24 Jul 2012 at 11:27pm
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

This page was generated in 0.016 seconds.