Infragistics Reporting is an awesome product that you can use to add reports to your applications. I know many of you have Windows Forms applications and are thinking of using the IG Reporting to quickly add a rich set of reports. I ALSO know that there are customers that have custom controls that they have invested TONS of time in creating, for example, custom scientific charts (wink!) and would LOVE to see them in the Infragistics Reports. Well, with the technique used in this article, you can do this, provided you can convert your custom control into an image. This technique takes advantage of the Infragistics Reporting product’s Image control’s ability to dynamically pick up images on the file system each time the report is generated. In this topic, I will use the Infragistics Windows Forms UltraWinChart as my “custom control that I want to add to the report”.
Download the sample here.
The execution logic is simple:
- Convert your control into an image and save it to disk. The Infragistics UltraWinChart has a method for that, so it is easy.
- Refresh your report
- THAT’S IT!
private void LoadData()
//Add dummy data to the chart control:
//Dump an image of the chart control:
Application.StartupPath + @"\Images\A.jpg",
//Render the report:
Project and Report Setup
That’s easy too. Add an Infragistics Reporting Image control to your report and set its ImageURL Property to a valid path and filename for your image. Remember, you will be generating that actual image and naming it as you have specified in the ImageURL Property, so keep that in mind.
That’s it! You can use this technique to dump ANY of your controls or anything else into an Image that will get picked up by the Infragistics Report at runtime!