Dynamic loading of an image into a report

Posted on 2006-06-04
Last Modified: 2012-06-21

I am using VS.Net 2003 and the version of Crystal Reports that is bundled with it.

Is it possible set the content of an object of the report to an image (from a C1Chart object).

For text objects, we can do this :
 CType(ReportToPrint.ReportDefinition.ReportObjects(vstrTextObject), CrystalDecisions.CrystalReports.Engine.TextObject).Text = vstrTextValue

Is there any way of doing something like this for images?
Question by:Éric Moreau
    LVL 100

    Expert Comment

    WHat type is the image?  Crystal is limited in the image types it handles.

    Can you save the chart as a bmp or jpg?

    LVL 69

    Author Comment

    by:Éric Moreau
    I bind my reports to schema (.xsd) and I use SetDataSource to pass a dataset to the report. I seems that I cannot have an image as part of my schema.

    >>Can you save the chart as a bmp or jpg?

    I can save the image to all the formats supported by System.Drawing.Imaging.ImageFormat (bmp and jpg are part of the list).
    LVL 69

    Accepted Solution

    I found something really interesting (at least I find it personally very interesting).

    This is how I did it:
    -I have added a field of type base64Binary to my schema.
    -I was then able to add this new field to my report (it appears as a IBlobFieldObject).
    -Then in my code, I can convert the image of my chart directly to a DataRow of my datatable without saving it this way:
                    Dim arrBytes() As Byte
                    chtSectors.SaveImage(arrBytes, System.Drawing.Imaging.ImageFormat.Jpeg)
                    dtChart.Rows.Add(New Object() {"SECTOR", "Sector Analysis", arrBytes})

    LVL 69

    Author Comment

    by:Éric Moreau
    any objections in sending this questions to PAQ?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now