1 void ViewCrystalReport() 2 { 3 Com comapp; 4 Com reporting; 5 str paramwhole; 6 str paramfilename; 7 str paramCond; 8 str ViewYesNo; 9 int ret; 10 COMVariant variant; 11 12 ; 13 14 variant = new COMvariant(COMVariantInOut::OUT,COMVariantType::VT_BOOL) ; 15 paramwhole = this.args().parm(); 16 comapp = new COM("CrystalRuntime.Application.11"); 17 18 ret = strfind(paramwhole,"|",2,strlen(paramwhole)); 19 20 paramfilename = substr(paramwhole,2,ret-2) ; 21 ViewYesNo = substr(paramwhole,1,1); 22 reporting = comapp.openreport(paramfilename); 23 reporting.discardsaveddata(); 24 reporting.readrecords(); 25 26 paramcond = substr(paramwhole,ret+1,strlen(paramwhole)); 27 28 reporting.RecordSelectionFormula(paramCond); 29 30 if (ViewYesNo == 'N') 31 { 32 variant.boolean(false); 33 reporting.PrintOut(variant); 34 } 35 else 36 { 37 ActiveX.ReportSource(reporting); 38 ActiveX.width(1200); 39 ActiveX.height(750); 40 ActiveX.DisplayToolbar(true); 41 ActiveX.DisplayGroupTree(false); 42 ActiveX.Refresh(); 43 ActiveX.ViewReport(); 44 ActiveX.Refresh(); 45 } 46 47 48 }