Solved

Rave print Image (2)

Posted on 2011-03-16
4
575 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

862 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

27 Experts available now in Live!

Get 1:1 Help Now