• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1623
  • Last Modified:

Dynamic loading of an image into a report

Hi

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?
0
Éric Moreau
Asked:
Éric Moreau
  • 3
1 Solution
 
mlmccCommented:
WHat type is the image?  Crystal is limited in the image types it handles.

Can you save the chart as a bmp or jpg?

mlmcc
0
 
Éric MoreauSenior .Net ConsultantAuthor Commented:
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).
0
 
Éric MoreauSenior .Net ConsultantAuthor Commented:
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})



0
 
Éric MoreauSenior .Net ConsultantAuthor Commented:
any objections in sending this questions to PAQ?
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now