on 10-03-2016 7:25 AM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 :
Error | 6 |
Cannot implicitly convert type 'CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument' to
'CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument'. An explicit conversion exists (are you missing a cast?) |
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;
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.