Skip to Content
0
Former Member
Apr 23, 2009 at 06:46 PM

Crystal Report 2008 XML in Delphi

39 Views

The solution of my problems, was with this same doubt as to make the crystal integration + xml, however instead of it java and vb would like it in delphi. somebody can help me? or to transform this code for delphi?

CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument reportClientDocument; 
            CrystalDecisions.ReportAppServer.Controllers.DatabaseController crDatabaseController;
 
            //Load report file
            string sampleReportPath = @"C:\report.rpt";
            reportDocument.Load(sampleReportPath);
            reportClientDocument = reportDocument.ReportClientDocument;
            crDatabaseController = reportClientDocument.DatabaseController;
 
            //Create all Properties
            CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag QELogonProperties = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();
            QELogonProperties.Add("Local Schema File", @"C:\Data\v101C\dev\temp\ttBillOFLading.xsd");
            QELogonProperties.Add("Local XML File", @"C:\Data\v101C\dev\temp\ttBillOFLading.xml");
 
            CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag QEProperties = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();
            QEProperties.Add("Database DLL", "crdb_xml.dll");
            QEProperties.Add("QE_LogonProperties", QELogonProperties);
 
            //Create Connection info and table
                        CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo ConnInf = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
            ConnInf.Attributes = QEProperties;
            ConnInf.Kind = CrystalDecisions.ReportAppServer.DataDefModel.CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
            ConnInf.Password = null;
            ConnInf.UserName = null;
 
            //Add Connection Information to a table and add the table to the report
            CrystalDecisions.ReportAppServer.DataDefModel.Table TBL = new CrystalDecisions.ReportAppServer.DataDefModel.Table();
            TBL.ConnectionInfo = ConnInf;
            TBL.Name = XMLName;
 
            //Then set the table to the report
           reportDocument.ReportClientDocument.DatabaseController.AddTable(TBL, null);
 
           //And save the report to disk
           object RepPath = @"C:\testreports";
           reportDocument.ReportClientDocument.SaveAs(DateTime.Now.ToFileTime().ToString(), ref RepPath, (int)CrystalDecisions.ReportAppServer.ClientDoc.CdReportClientDocumentSaveAsOptionsEnum.cdReportClientDocumentSaveAsOverwriteExisting);

pleaseeeeeeee