Solved

Rave print Image (2)

Posted on 2011-03-16
4
588 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 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

Industry Leaders: 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…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month8 days, 17 hours left to enroll

617 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