Static height in detail band

bsubsu
edited 11:30AM in FastReport VCL 5
Hi,

I am using delphi 2010, and I am a newbie in FastReport.

I create one masterdata and one detaildata in the report.

How can I fix the height of detaildata band, so it can only show max. 10 rows in one page (inside the box)?



Thank You.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    write code in the obp event of the band to force the engine to a new page
    you might use the line number variable or check the engines free space
    it might be as simple as
    if(< line#> = 9 ) then engine.newpage;
  • bsubsu
    edited February 2016
    gordk wrote: »
    write code in the obp event of the band to force the engine to a new page
    you might use the line number variable or check the engines free space
    it might be as simple as
    if(< line#> = 9 ) then engine.newpage;

    Thank you for your reply.

    Yes, I did write the below code:

    k := <Line#>;
    if (k mod 20 = 0) and (k> 1) then
    Engine.newpage;

    However, the 'line' cannot be reprinted in the 2nd page.

    Is there any way to 'fix' the height of the detail band, and the 'box' (height of the line will not change in the 2nd page) in the detail band can be printed each page?

    I am just starting to research FastReport about 3 days, sorry if I design the report wrongly.
    Can you give me a sample about how to achieve it?

    Thank You.
  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    post your .fr3 file here in the forum
    also save and post a report output .fp3 file
  • bsubsu
    edited February 2016
    gordk wrote: »
    post your .fr3 file here in the forum
    also save and post a report output .fp3 file

    Sorry, I can only upload one .fr3 here.
    Another output file is fail to be uploaded here.


    The detail data is printed in different page now, but the lines (box with static height) cannot be reprinted in the 2nd page. I cannot find any reprint in the line option, How?

    Thank You.
  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    first i am not sure why you are using a subreport object you could use a detaildataband if the datasets are related
    ptooks like you are using yhe master databand to retrive data for the headerif that is the case
    set the master data to 0 height
    add a detail band move the items in the subreport md band to the detaildataband and use the memo's frames for your lines put your code in the obp event of the detail data band
    your variable k was declared as private to the event so it resets on every firing
    it should be declared in the top code page before the empty begin end block then it is global
    any how you should not need it if using a detaildataband.
    you will need to write some code in the obp of the detaildataband to turn on and off the desired frames of the memos.
  • bsubsu
    edited 11:30AM
    gordk wrote: »
    first i am not sure why you are using a subreport object you could use a detaildataband if the datasets are related
    ptooks like you are using yhe master databand to retrive data for the headerif that is the case
    set the master data to 0 height
    add a detail band move the items in the subreport md band to the detaildataband and use the memo's frames for your lines put your code in the obp event of the detail data band
    your variable k was declared as private to the event so it resets on every firing
    it should be declared in the top code page before the empty begin end block then it is global
    any how you should not need it if using a detaildataband.
    you will need to write some code in the obp of the detaildataband to turn on and off the desired frames of the memos.

    Thank you very much, gordk.

    Sorry, I am not very clear about your suggested solution, can you please to provide me a .fr3 file?
    I am just starting to study the FastReport about 4 days, I am still a newbie.

    Actually, I am facing some printing problem in the old reporting tool of my company, so I am testing and checking the FastReport as a replacement for it.

    The report format is:
    1) the header/master info has to reprint in each page.
    2) The detail items will stay inside the box.
    3) The height of the box will not be changed in every page.

    The attached image is the final output of the report.


    Thank You.




  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    your best way to learn about fr is to build the demo report in the user manual
    what version of fr are you using?
  • gordkgordk St.Catherines On. Canada.
    edited 11:30AM
    here are some tips for designing looking at your report
    in designer select the page in properties panel check large height in design
    the memo with air" invoice" if you want it on every page use a pageheader band not a header band
    assuming your using the master band and detail band layout i suggested previously
    and your code is producing the page output you want
    add an overlay band at the bottom of the report make its height = page height - 1or2 pixels
    in the overlayband add your lines or a rectangle object with frames to create your box
    where you want it to appear
    when the engine processes the overlay the top of the overlay corresponds to the top of the page
  • bsubsu
    edited 11:30AM
    gordk wrote: »
    here are some tips for designing looking at your report
    in designer select the page in properties panel check large height in design
    the memo with air" invoice" if you want it on every page use a pageheader band not a header band
    assuming your using the master band and detail band layout i suggested previously
    and your code is producing the page output you want
    add an overlay band at the bottom of the report make its height = page height - 1or2 pixels
    in the overlayband add your lines or a rectangle object with frames to create your box
    where you want it to appear
    when the engine processes the overlay the top of the overlay corresponds to the top of the page


    gordk, thanks a lot.

    I just get the idea how to design it.
    Actually, I am using a group footer, footer and child band to 'fill' the extra space if the number of detail row is less than 20 (20 rows each page).

    procedure DetailData1OnBeforePrint(Sender: TfrxComponent);
    Var vLineCount : Integer;
    begin
    vLineCount := <Line#> - 1 ;
    if (vLineCount mod 20 = 0) and (vLineCount> 1) then
    begin
    Footer1.Visible := True;
    engine.showband(Footer1);
    Engine.newpage;
    end;

    Footer1.Visible := False;
    end;

    procedure GroupFooter1OnBeforePrint(Sender: TfrxComponent);
    Var i, vNumOfRow : Integer;
    begin
    vNumOfRow := 20;

    for i := 1 to (vNumOfRow * (Trunc(<Line>/vNumOfRow) + 1)) - <Line> do
    begin
    child2.Visible := True;
    engine.showband(child2);
    end;
    Footer1.Visible := True;
    engine.showband(Footer1);

    child2.Visible := False;
    end;


    Of course, the report still have some problem, but at least the output is same as the attached pic.

    Overlap band is another option, I will try it later.


    Thanks. :lol:" border="0" alt="laugh.gif" />" alt=">" />

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.