Symptom
- An image is stored in directory c:\temp.temp
- Using the ReportClientDocument.ReportDefController.ReportObjectController to import the image results in an Exception
Environment
- Crystal Reports 2008
- Visual Studio .NET 2008
- Crystal Reports for Visual Studio 2010
- Visual Studio 2010
Reproducing the Issue
- Create a folder called c:\temp.temp and copy an image file into it
- Use the following code to import the image into a report:
private void PictureData_Click(object sender, EventArgs e)
{
rptClientDoc = new ReportClientDocumentClass();
CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject boPictureObject;
CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;
rpt.Load(@"C:\temp.temp\imageReport.rpt");
rptClientDoc = rpt.ReportClientDocument;
//Determine which section to add the picture field to - in this case the report header section
boSection = rptClientDoc.ReportDefController.ReportDefinition.ReportHeaderArea.Sections[0];
//Add the image to the report
boPictureObject = rptClientDoc.ReportDefController.ReportObjectController.ImportPicture(MyfilePath, boSection, 1, 1);
}
Cause
Resolution
- The issue is resolved in Service Pack 2 for Crystal Reports for Visual Studio 2010
- The issue is resolved in Service Pack 4 for Crystal Reports 2008
Keywords
CR2010 2010 CR4VS2010 CR4VS VS2010 NET2010 Crystal Reports for .NET Framework 4.0 crforvs 13 CR2008 2008 12 , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Bug Filed
Product
Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio