Crystal report viewer 控件TCrystalActiveXReportViewer的使用

来源:互联网 发布:c语言怎么写驱动 编辑:程序博客网 时间:2024/06/12 01:02
procedure TGL_CC_ReportCollection.OpenReport( const ReportFileName: string;
                                               fromMenuPrinc : Boolean);
var
   FormCrystal  : TForm;

begin
   try
     Screen.Cursor := crHourGlass;

     try

       FormCrystal := TFormCrystal.Create(Forms.Application);
       FormCrystal.Name := 'TFormCrystal';

       Try
         CrystalActiveXReportViewer :=
TCrystalActiveXReportViewer.Create(FormCrystal);

         oApp :=CreateOleObject('CrystalRuntime.Application');
         oRpt:=oApp.openreport(ReportFileName,1);
         CrystalActiveXReportViewer.ReportSource := oRpt;

         InitializeReport(CrystalActiveXReportViewer, FormCrystal);
         ShowReport(CrystalActiveXReportViewer, FormCrystal);
       End;  (* Try *)

     except
       on E:Exception do
       begin
         raise;
       end;                   // on..end
     end;                     // try..except
   finally
     Screen.Cursor := crDefault;
   end;                       // try..finally
end;                         // OpenReport..end
 
原创粉丝点击