Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Rave print Image (2)

Posted on 2011-03-16
4
Medium Priority
?
596 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:Ephraim Wangoya
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:Ephraim Wangoya
Ephraim Wangoya earned 248 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 252 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

916 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