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

How to force reprint in OnEndFirstPass

edited February 2004 in General
Hi,

All I want to do is to determine the width of report.
I want to have whole row on one page so I want to set PaperWidth to
width of the report in a preview mode.

I try to do it like this:
procedure TDM.ReportEndFirstPass(Sender: TObject);
begin
if FPageCount <> Report.PageCount then begin
FPageCount := Report.PageCount;
Report.PrinterSetup.PaperWidth := Report.PrinterSetup.PaperWidth*2

// here I want to force reprint or just repeat first pass that will use
new value of PaperWidth ??
rbPredObdObiskInkaso.PageLimitReached;
rbPredObdObiskInkaso.ResetDevices;
end;
end;




If there is any other way to implement this kind of behavior please help.

best regards
M. Matej

Comments

  • edited February 2004
    Hello,

    I am unclear about what you are trying to accomplish. Why is it necessary
    to chang the paper sized after the first pass of the report. Also, the
    preview will reflect the paper size when ever you decide to set its value.
    You can also try calling Report.Reset to regenerate the report.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited February 2004
    I have a report that can be very wide so I can't print it on the paper
    withot horizontal split wich I don't want to have because the report
    becomes unreadable.
    I want whole report on one page (without horizontal split -> PaperWidth
    = Report width) also in preview (that is also necessary when exporting
    to excel).
    As I figure it out the only way to calculate the actual width of report
    is after first pass when pages are generated. I can do that somehow but
    I don't know how to force report to be generated again from the start
    (first pass).
    When I call Report.Reset, .ResetDevices, .PageLimitedReached or .Stop
    report always countinues with second pass so I get very strange looking
    preview (after first pass I have 20 pages and when I change paperwidth I
    get 10 pages while preview has 20 pages: first ten from new paperwidth
    value and last ten from old paperwidth value).


    1.) After first pass how to force report to be regenerated from start

    2.) Is there any easy way to set paperwidth to report width and
    paperheight to report height?

    3.) When printing to file there is no need for pages (at least in most
    cases: excel, text, ...) so how can I change paperwidth and paperheight
    when printing to file is selected from preview form?

  • edited February 2004
    Hello,

    Thanks for the explaination. Unfortunately the entire report generation
    process in ReportBuilder relies on knowing the page size before the report
    is generated. After the first pass, the report width is calculated but
    there is no way to reset the paperwidth as the report engine has alread used
    the current paper width to make the page calculations. It is also
    impossible to regenerate the entire report after the first pass.

    One way to accomplish this would be to calculate the report width before
    trying to print the report. If you are placing dynamically sized images or
    columns in a report, you can use the positioning of these components at runt
    time in conjunction with the amount of data you have to make a calculation
    of how wide the report is going to be and then set the size of the paper
    accordingly.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.