将QuickReport报表保存为图片(使用TMetaFile和TMetafileCanvas)

//将报表第iPageNo页存为BMP文件   
  procedure   ReportSaveToBMPFile(sFileName   :string;   iPageNo   :integer);   
  var   
      E:   TMetaFile;   
      B:   TBitmap;   
  begin   
      E   :=   QRPreview1.QRPrinter.GetPage(iPageNo);   //想要第几页   
      B   :=   TBitmap.Create;   
      try   
          with   TMetafileCanvas.Create(E,   0)   do   
          try   
              B.Height   :=   E.Height;   
              B.Width   :=   E.Width;   
              B.Canvas.Draw(0,   0,   E);   
              B.SaveToFile(trim(sFileName));   
          finally   
              Free;   
          end;   
      finally   
          B.Free;   
      end;   
  end;   

 

http://www.cnblogs.com/snow001x/archive/2009/01/07/1371166.html

posted @ 2017-07-11 18:24  findumars  Views(615)  Comments(0Edit  收藏  举报