Solved

Rave print Image (2)

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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

751 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