Re:How can I preveiw saved Quick Report Reports?
Hi Zane,
I'm no expert and I'm not 100% sure but I did spend quite a lot of time
working with QReport. The custom preview VCL that is provided with QReport
works by simply copying the main reports canvas over to the QPreviews
canvas. As I mentioned in a previous post, it's very resource hungry (or it
was on my system). As far as I know, you will have to load the *.qrt report
by your main report that you have designed, and then once loaded, assign the
canvas of the reports to the canvas of the custom preview. I might be wrong
but the documentation is terrible and I couldn't find any other solution.
to assign the canvas from the main report (which you can hind so that its
not visible to the user), to the custom preview, you can use the following
code:
Application->ProcessMessages();
TCursor SaveCursor = Screen->Cursor;
Screen->Cursor = {*word*99}pStart;
try
{
MainReport->Prepare(); // I usually
hide this behind a PageControl!
while (!MainReport->Available) // waits until the
report becomes avalible
{ //
I know this is {*word*99} but it was the only way i could get it to work,
Application->ProcessMessages(); // you can access the
canvas if it busy!!!!
}
if ((MainReport->QRPrinter != NULL)&&(MainReport->Available)) //
Double check
{
try
{
CustomPreview->QRPrinter = MainReport->QRPrinter;
}
catch(...)
{
// Catch any exception here - and there can be several.....
}
}
__finally
{
Screen->Cursor = SaveCursor;
Application->ProcessMessages();
As I recall, you have to do some checking when you close the Form /
application, something along the lines of:
if (MainReport->QRPrinter)
{
MainReport->QRPrinter->ClosePreview(this);
if (CustomPreview->QRPrinter)
{
CustomPreview->QRPrinter->ClosePreview(this);
Hope this helps, to be honest I would use FastReport :-) - QReport is cruel
and unusual.
Mike C
Quote
"Zane Jones" <s...@of.spam> wrote in message
news:3da35374@newsgroups.borland.com...
Quote
> I want to include a quick report loader in my app. I.e set the report to
> preview on the HDD and preview it. I don't really want to use third party
> components to do this.
> Any ideas?