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

Header spanning more than one page.

edited June 2002 in General
I have a situation where in I have to print a series of charts in the header
band. I have various regions in the header band and one of then is the
"ChartsRegion". I need to print the charts in this region. This region will
be shown only for the first page and I hide this region for subsequent
pages. Everything works fine if the no of charts is less than 2 so that the
header band fits in one page and the detail band starts right ater as
expected.. However, things go awry when I have more number of charts to be
printed. It prints the first page with as many charts as it can fit, but it
does not print any pages after that. I just get a blank second page and when
I try to go the last page it just keeps printing empty pages endlessly. Now,
my problem is not the endless pages. The problem is that it failed to print
the header and the charts from the second page onwards.

Any alternative solutions for printing the charts before the detail band? I
have a sample application which can reproduce this problem.

Thanks,
Vikram

Comments

  • edited July 2002
    I tried reproducing this with a region of multiple charts and stretching
    components that would puch the chart region to overflow onto a new page, but
    with no luck. The remaining charts properly finished printing on the
    following page. Are there any components which are trying to print that have
    KeepTogether set to true? This case could cause a situation where a
    component tries to print but is unable to and keeps overflowing.You could
    also try simplifying the report step by step until (and if) the problem
    dissapears, hopefully narrowing down the problem. If the problem still
    persists you can send a sample project which reproduces this problem to
    support@digital-metaphors.com.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    I appreciate your response.

    Actually we overcame that problem in a different way. We now calculate
    before hand how many charts we can fit on a page and print only that many
    charts. So there would be no over flow.
    But we have a different problem now. We do not know how many charts will fit
    in a page unitl we run the report. So we just dropped only one TppImage
    component on the chart region in the Header band and wrote some code in the
    OnBeforeGenerate of the header band which creates additional TppImage
    components depending on how many more images could be displayed on that
    page. Unfortunately, there seems to be a problem with this. Only one image
    is showing up and thats the image component that was dropped on the report.
    So our dynamically created image components are not getting displayed
    eventhough the code steps through just fine in the OnBeforeGenerate event.

    So the question boils down to : Can we create additional report builder
    components in the OnBeforeGenerate of the band?

    Thanks,
    Vikram

    "Alexander Kramnik (Digital Metaphors)" wrote
  • edited July 2002
    First, it is not a good idea to create component in the BeforeGenerate event
    because if that event is fired more that once you'll create unwanted
    component. You can do it either before you call the Report.Print or in the
    global OnCreate. What's the code you are using to dynamically create an
    image? The code below will create an image and place it at the upper left
    corner of the header band.

    lImage := TppImage.Create(ppReport1);

    lImage.Left := 0;
    lImage.Top := 0;
    lImage.Band := ppHeaderBand1;
    lImage.Picture.LoadFromFile('C:\myBmp.bmp');

    Also, make sure that you are either sizing the band properly when adding the
    new images, or making it dynamic height. Another option you can try is
    instead of putting all the charts into the band you can drop a subreport
    into the band and place the charts into the subreport.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited July 2002
    I had that suspicion too (not to create objects in the B4Gen event..).
    Anyways the code that we used to create the component is as follows:
    With TppImage.Create(ppreport1) do
    Begin
    Region := ppRegion1;
    Band := ppHeaderBand1;
    Name := 'MyImage';
    Picture.LoadFromFile('C:\myBmp.bmp');
    AutoSize := True;
    Top := ppRegion1.Top + 0.005;
    Left := 0.009;
    Visible := True;
    End;

    I think I should move this code to before I even print the report as per
    your suggestion.

    Thanks,
    Vikram

    "Alexander Kramnik (Digital Metaphors)" wrote
This discussion has been closed.