Solved

Rave print Image (2)

Posted on 2011-03-16
4
572 Views
Last Modified: 2012-05-11
the code below is functional, but -
can I replace

this line :   GraphicFieldToBitmap( ReportTableGraphic  , Bitmap);  

with      .....  ReportTable.FieldbyName('Graphic').as ???  ..... code  
procedure TForm1.RavePrintDBBitmap ( XPOS, YPos , Xsize, YSize : Real ; AReport : TBasereport );
var  Bitmap              : TBitmap;
     TableGraphicField   : TGraphicField;
begin


        // TableGraphicField := ;

        Bitmap := TBitmap.Create;
        try

          GraphicFieldToBitmap( ReportTableGraphic  , Bitmap);
          AReport.PrintBitmapRect(XPos,YPos,XPos + Xsize, YPos + YSize,Bitmap);
        finally
          Bitmap.Free;
        end;

end;

Open in new window

0
Comment
Question by:BdLm
  • 2
4 Comments
 
LVL 32

Expert Comment

by:ewangoya
ID: 35150521

No you cant

There is no TField property that will convert binary data to Image data

You have to convert the data properly to a Graphic object
0
 
LVL 8

Author Comment

by:BdLm
ID: 35150549

the issue I have - the name of the field will change for different table types ......  any other solution
0
 
LVL 32

Assisted Solution

by:ewangoya
ewangoya earned 62 total points
ID: 35150975
you could use a stream to first get the field data then save it to a bitmap

var
  F: TField;
  Bitmap  : TBitmap;
  Stream: TMemoryStream;
begin
   F := ReportTable.FieldbyName(YourFieldName);
   Stream := TmemoryStream.Create;
   try
       TBlobField(F).SaveToStream(Stream);
        Bitmap := TBitmap.Create;
        try
          Stream.Seek(0, soFromBeginning);
          Bitmap.LoadFromStream(Stream);
          AReport.PrintBitmapRect(XPos,YPos,XPos + Xsize, YPos + YSize,Bitmap);
        finally
          Bitmap.Free;
        end;
    finally
       FreeAndNil(Stream);
   end;
0
 
LVL 24

Accepted Solution

by:
jimyX earned 63 total points
ID: 35151002
You can cast the field as follows:
procedure TForm1.RavePrintDBBitmap ( XPOS, YPos , Xsize, YSize : Real ; AReport : TBasereport );
var  Bitmap              : TBitmap;
     TableGraphicField   : TGraphicField;
begin
        // TableGraphicField := ;
        Bitmap := TBitmap.Create;
        try
          //GraphicFieldToBitmap( ReportTableGraphic  , Bitmap);
          GraphicFieldToBitmap(TBlobField(ReportTable.FieldbyName('Graphic')), Bitmap);
          AReport.PrintBitmapRect(XPos,YPos,XPos + Xsize, YPos + YSize,Bitmap);
        finally
          Bitmap.Free;
        end;
end;

Open in new window

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now