Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Problem Creating/viewing simple report using an archive file

edited October 2003 in General
Hi

I am having a very irritating problem that hopefully someone will be able to
help me with very quickly.

I am using ReportBuilder Enterprise on Delphi 6.

To recreate my problem, please create an application with a form and a
button. Then paste the code below into the button click

VAR FReport:TppReport;
objArchiveReader:TppArchiveReader;
begin

{Create the report}
FReport:=TppReport.Create(Form2);

{Load the template - only contains an image}
FReport.Template.FileName:='c:\template.rtm';
FReport.Template.LoadFromFile;

FReport.ShowPrintDialog:=False;
FReport.AllowPrintToArchive:=True;
FReport.DeviceType:=dtArchive;

FReport.ArchiveFileName:='c:\Report'+FormatDateTime('ddmmyyhhmmss',Now)+IntT
oStr(Random(1000))+'.raf';

TRY
FReport.Print;
EXCEPT
ON E:EXception DO
Caption:='E.Message';
END;

FReport.Free;

objArchiveReader:=TppArchiveReader.Create(Form2);
objArchiveReader.ArchiveFileName:='c:\Report0110031605180.raf';
objArchiveReader.DeviceType:=dtScreen;
objArchiveReader.Print;
end;

The problem I have is that using this code, I only get a very small archive
file, which is very small but I cannot view this file using the archive
viewer.

Even more strange is that the program never gets beyond the FReport.Print.

This is a very simple task and I cannot understand why it is giving so much
grief. The report template file I use is attached, its just simply a blank
report with a single label, no data pipelines or anything like that, I
intend to add them in due course.

Please can someone help asap

Cheers

Paul

Comments

  • edited October 2003
    Hello

    Some more information - This issue only seems to occur when I output the
    report to an archive file.

    The fact that I cannot get to the code after print is because report builder
    goes into an infinite loop!

    The loop that it is getting stuck in is in ppEngine.pas line 553, the one
    with the comment

    " {loop until all page requests granted or printing cancelled}" above

    BTW IsMultiThread is true in my application but I am not actually doing
    anything with threads at present

    Looks like this may be a problem in report builder.

    Please can someone respond asap as I am really out of ideas now

    Cheers

    Paul
  • edited October 2003
    Hi Paul,

    For future reference, we ask that you do not post attachments to the news
    groups. If you need to send an attachment, please e-mail your quesiton to
    support@digital-metaphors.com.

    Looking at your code I was able to find two issues.

    First, in your template, you have Report.AutoStop set to False. By
    definition, a report will generate endless pages if it is not connected to a
    datasource unless the AutoStop property is set to True. You can either save
    this in the template or do it in code before you print the report :
    FReport.AutoStop := True;

    Second, I am a bit unclear how you are loading the correct file name for the
    archive. You generate the file name with the current date and time to the
    second. Then you hard code the name of the archive file to be viewed. This
    seems like it may be a bit difficult to ensure the file names are the same.
    I changed both file names to "archive.raf" and all worked correctly.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2003
    Thanks for your help Nico

    Attachment request noted.

    Did not know about the Autostop property

    cheers

    Paul

This discussion has been closed.