2009-11-24 82 views
1

我有一个在Delphi 2009和Rave Reports中开发的应用程序。我想在报告中打印一张图片。我将如何实现这个?在Rave Reports中打印图像

任何建议将非常感激。

回答

0

使用Draw(X,Y:Double; Graphic:TGraphic); TBaseReport后裔的方法,除非您正在绘制位图。在这种情况下,使用TBaseReport.PrintBitmap(X,Y:Double; ScaleX,ScaleY:Double; Bitmap:TBitmap);或PrintBitmapRect(X1,Y1,X2,Y2:Double; Bitmap:TBitmap);

抽奖()是记录在MS-帮助D2009帮助文件://embarcadero.rs2009/Rave/draw.htm

var 
    MyLogo: TGraphic; 
begin 
    MyLogo := TMetafile.Create; 
    try 
    MyLogo.LoadFromFile('MYLOGO.WMF'); 
    RvNDRWriter1.Draw(1.0,2.0,MyLogo); 
    finally 
    MyLogo.Free; 
    end; { tryf } 
end; 

你可以找到的Delphi 2009帮助文件PrintBitmap的例子,主题ms-help://embarcadero.rs2009/Rave/printbitmap.htm - 在PrintBitmapRect()的页面上有一个链接。

// Print MyBitmap in upper left corner four times its size 
RvNDRWriter1.PrintBitmap(1.0, 1.0, 2.0, 2.0, MyBitmap); 
+0

我注意到这些答案中的大部分(关于Rave)通常假设人们完全通过代码编写报告。没有视觉设计师吗? (我仍然使用它,但是,Delphi对我们来说是Legacy)。 – Tobiasopdenbrouw 2010-07-14 19:25:28

0

我与Rave Reports有同样的问题,它取决于您想要预览或打印的图像类型。如果这是您可以使用的肯·怀特的例子一个WMF:

var 
    MyLogo: TGraphic; 
begin 
    MyLogo := TMetafile.Create; 
    try 
    MyLogo.LoadFromFile('MYLOGO.WMF'); 
    RvNDRWriter1.Draw(1.0,2.0,MyLogo); 
    finally 
    MyLogo.Free; 
    end; { tryf } 
end; 

但使用BMP时:

RvNDRWriter1.PrintBitmap(1.0, 1.0, 2.0, 2.0, MyBitmap); 

,并使用JPEG图像时:你有JPEG先转换为BMP使用之前调用RvNDRWriter1。

Jpeg2bmp('temp.bmp',jpegfile); 
pic1.picture.loadfromfile('temp.bmp'); 
pic1.Visible:=true;