cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically using the OLE object

Former Member
0 Kudos

I have a requirement to embed documents in the crystal report using dynamic ole object i.e. using asp.net C# code to add ole object.

any help or solution any one can share?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Moved to SDK forum

How to:

#region Original

rpt.Load("D:\\CPP Net\\RASXIR2Printer\\oleobject.rpt");

rptClientDoc = rpt.ReportClientDocument;

String MyfilePath = "C:\\temp\\mansheart.jpg";

//Determine which section to add the picture field to - in this case the report header section

CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;

boSection = rptClientDoc.ReportDefController.ReportDefinition.PageFooterArea.Sections[0];

boSection.Height = 1010; // in twips

boPictureObject.Left = 1010;

boPictureObject.Width = 500;

boPictureObject.Height = 200;

boPictureObject.Top = 100;

boPictureObject.OriginalWidth = 50;

boPictureObject.OriginalHeight = 30;

boPictureObject.Name = "dontest";

//Add it to the report

boPictureObject = rptClientDoc.ReportDefController.ReportObjectController.ImportPicture(MyfilePath, boSection, 1, 1);

rpt.SaveAs("c:\\temp\\savedimage.rpt", true);

MessageBox.Show("c:\\temp\\savedimage.rpt", "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);

#endregion Original

}

Don

Former Member
0 Kudos

thanks for the reply but it gives error. can u check where i am doing wrong.

#region Original

        ReportDocument rpt=new ReportDocument();

        ReportClientDocument rptClientDoc=new CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument();

        rpt.Load("Reports/CrystalReport.rpt");

        rptClientDoc = rpt.ReportClientDocument;  --- > Error on this line

        String MyfilePath = @"D:\Images\avatar.jpg";

        //Determine which section to add the picture field to - in this case the report header section

        CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;

        boSection = rptClientDoc.ReportDefController.ReportDefinition.PageFooterArea.Sections[0];

        boSection.Height = 1010; // in twips

        CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject boPictureObject;

        boPictureObject.Left = 1010;

        boPictureObject.Width = 500;

        boPictureObject.Height = 200;

        boPictureObject.Top = 100;

        boPictureObject.OriginalWidth = 50;

        boPictureObject.OriginalHeight = 30;

        boPictureObject.Name = "dontest";

        //Add it to the report

        boPictureObject = rptClientDoc.ReportDefController.ReportObjectController.ImportPicture(MyfilePath, boSection, 1, 1);

        rpt.SaveAs("c:\\temp\\savedimage.rpt", true);

        #endregion Original

Error :

Error6

Cannot implicitly convert type 'CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument' to

'CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument'. An explicit conversion exists (are you missing a cast?)
0 Kudos

Add all  of these assemblies:

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

using CrystalDecisions.ReportAppServer;

using CrystalDecisions.ReportAppServer.ClientDoc;

using CrystalDecisions.ReportAppServer.Controllers;

using CrystalDecisions.ReportAppServer.ReportDefModel;

using CrystalDecisions.ReportAppServer.CommonControls;

using CrystalDecisions.ReportAppServer.CommLayer;

using CrystalDecisions.ReportAppServer.CommonObjectModel;

using CrystalDecisions.ReportAppServer.ObjectFactory;

using CrystalDecisions.ReportAppServer.Prompting;

using CrystalDecisions.ReportAppServer.DataSetConversion;

using CrystalDecisions.ReportAppServer.DataDefModel;

using CrystalDecisions.ReportSource;

CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rptClientDoc;

Answers (0)