I try to trap the 'Canvas' of a QRPrinter into a TCanvas or TMetaFileCanvas to
export it to a Bitmap or something. The reason I want to do this is for sending
Faxes.. (Asynch from TurboPower? moeha)..
Anyway..
QuSoft can't help me out because they don't reply anymore ;) If anyone finds
out how to do this.. let me know.. let US know ;)
Exporting to ASCII or something else ain't an option.
Greetings,
Analyzer
--
__ __ _
/ //_/__ __ _ __ ______(_)
Geert Vanderkelen / ,< / -_) ' \/ // / __/ /
Executive /_/|_|\__/_/_/_/\_,_/_/ /_/
geert.va...@kemuri.be Systems
http://www.kemuri.be
I'm using Delphi 2.01 and QR1.1 and I've successfully accessed the
images that QR generates. You are on the right track. These images are
in the form of metafiles and can be obtained via properties of the
QRPrinter object. I'm not sure about versions of QR greater than 1.1
though. Look in the QR manual for more info. (The manual is a Word doc
and should be somewhere on the Delphi CD.
I'm feeling lazy today so I'm not going to dig out my code, however if
you would like to see an example let me know and I'll find it. I do
remember that you have to prepare the report (QRPrinter.Prepare?)
manually though.
Good luck!
Mike
Mike Kolter wrote:
>
> Hello Analyzer,
> I'm using Delphi 2.01 and QR1.1 and I've successfully accessed the
> images that QR generates. You are on the right track. These images are
> in the form of metafiles and can be obtained via properties of the
> QRPrinter object. I'm not sure about versions of QR greater than 1.1
> though. Look in the QR manual for more info. (The manual is a Word doc
> and should be somewhere on the Delphi CD.
Manual doesn't help me out Like I said before.. Even QuSoft can't help.. but..
> I'm feeling lazy today so I'm not going to dig out my code, however if
DON'T DON'T FEEL layz today ;)))
I know good programmers a lazy.. but..
> you would like to see an example let me know and I'll find it. I do
Plz :)
> remember that you have to prepare the report (QRPrinter.Prepare?)
> manually though.
Wel, doesn't help in QR 2.0J :(
>
> Good luck!
Thx.. I try it once more :/
Analyzer
--
__ __ _
/ //_/__ __ _ __ ______(_)
Geert Vanderkelen / ,< / -_) ' \/ // / __/ /
Executive /_/|_|\__/_/_/_/\_,_/_/ /_/
geert.va...@kemuri.be Systems
http://www.kemuri.be
UIN: 5355458
Try the following two routines:
**Keep in mind that this works for QR1.1, but unknown for other
versions.** GetPageShots will fill a TStringList with metafiles for
each page in the print range. Before calling GetPageShots call
QuickReport1.Prepare (which actually assembles the report and creates
the metafiles). Afterwords, be sure to call QRPrinter.CleanUp to take
of any resources allocated by QRPrinter.
A word about the documentation for QR...
Along with the PageShots stuff I'm doing other things that are just as
complex (if not more) with QR. The documentation sucks, I know. But
that's where I learned (along with trial and error) how do this and
other things.
That being aside, I'm glad to help out where I can. Working with QR is
sometimes frustrating at the least, but I've been able to do some very
powerful things with it and I have yet to encounter a problem that I
cannot work around.
Again, Good luck, and holler if you have any more questions.
Mike
Procedure TReportTemplate.ClearPageShots(PageShots : TStringList);
Begin
While PageShots.Count > 0 do
Begin
TMetaFile(PageShots.Objects[0]).Free;
PageShots.Delete(0);
End;
End;
Procedure TReportTemplate.GetPageShots(PageShots : TStringList);
Var
I,
FromPage,
ToPage : Integer;
TempMetaFile : TMetaFile;
Begin
If (QRPrinter.FromPage = 0) and (QRPrinter.ToPage = 0) Then
Begin
FromPage := 1;
ToPage := QRPrinter.PageCount;
End
Else
Begin
FromPage := QRPrinter.FromPage;
ToPage := QRPrinter.ToPage;
End;
ClearPageShots(PageShots);
For I := FromPage to ToPage do
Begin
TempMetaFile := TMetaFile.Create;
QRPrinter.PageNumber := I;
TempMetaFile.Assign(QRPrinter.Page);
PageShots.AddObject(IntToStr(I), TempMetaFile);
End;
End;
Not sure if anybody knows the answer to this but here goes.
OK, in your code below you've managed to get at the MetaFiles for the pages
of a Quick Report, what I would like to do is convert the MetaFile(s) into
RTF, Text or HTML maintaining tabs and column layout of objects in the
MetaFile. I know there are OCR tools out there but are there any Delphi
components or classes that do this?
It would be nice to create one's own converter or marry a process with an
existing converter that would provide the means to bypass the ExportFilter's
of Quick Reports and really get granular with what one could do with a
Report once it has been assembled, in relation to exporting the report
content to an external file.
Any help is appreciated.
Thanks.
Brian Armstrong.
Mike Kolter wrote in message <34C630...@prairie.lakes.com>...
I personally have no idea of how to do what you want to do with QR.
Version 1.1 only produces metafiles and it would surprise me if any
later version of QR does anything different. If the metafiles the QR
produces is not sufficient for your needs, you may want to check into a
report writer that actually produces textual reports (instead of
graphical reports). Switching report writers will probably be a lot
easier than trying to force QR to do something that it was intended to
do.
Sorry I couldn't be of more help.
BTW - It *might* not be too hard to write a component that produces
simple rtf files generated from a datasource. Think of it as something
like a mail-merge component on steriods. Don't know though. I don't
have the need for anything like that (yet).
Mike
CREDITS TO Mike Kolter!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Helped me alot :)
/* warning some cool style prog stuff like 'fail' = file ;)) */
var
myMetaFail : TMetaFile;
begin
myMetaFail := TMetaFile.Create;
QuickRep1.Prepare;
QuickRep1.QRPrinter.PAgeNumber := 1;
myMetaFail.Assign(QuickRep1.QRPrinter.Page);
myMetaFail.SaveToFile('f:\afax.emf');
form2.thefax.picture.loadfromfile('f:\afax.emf');
form2.show;
end
This is it :) The clue wasn't to get that bloody Canvas, but the 'Page' of
QRPrinter! Shit, djesus.. hahahaha :)) This produces a EMF like you never seen
before..
Maybe their are people how had it like this, well this is for the staff you
hadn't :)
Now.. Great stuff can be done with this.. like faxing or someting :)
Mike Kolter wrote:
>
> Hi Brian,
>
> I personally have no idea of how to do what you want to do with QR.
I wanted a file type which I could send via MAPI easly.. Hope this MetaCrap
will help. But is was more a stupid programming bug in my haed ;) Thx once more
solving it.
> Version 1.1 only produces metafiles and it would surprise me if any
> later version of QR does anything different. If the metafiles the QR
> produces is not sufficient for your needs, you may want to check into a
> report writer that actually produces textual reports (instead of
> graphical reports). Switching report writers will probably be a lot
> easier than trying to force QR to do something that it was intended to
> do.
Well, textual don't give Graphics and so.
>
> Sorry I couldn't be of more help.
hehe.. ya wrong
>
> BTW - It *might* not be too hard to write a component that produces
> simple rtf files generated from a datasource. Think of it as something
> like a mail-merge component on steriods. Don't know though. I don't
> have the need for anything like that (yet).
>
> Mike
Happy Analyzer