Working with Anchors

edited 1:38AM in FastReport 4.0
hello,

I need to build a complex Report out of several small reportfiles. These files I append with "frxReport1.PrepareReport(false)" to the report engine. I need to build a Contents-Chapter (TOC), so in some of the files an Anchor will be created with "Engine.AddAnchor( );".

All the reportfiles inherites from a base report file in which I set the option "two-pass".

First Problem: the Engine.GetAnchorPage always returns 1
second Problem: after export to PDF the Anchors don't work anymore.

Is there any solution?

Thanks
Lemmy

Comments

  • Anu de DeusAnu de Deus Hampshire, UK
    edited August 2009
    When building a big report out of smaller ones, I always create the main TfrxReport object in my code, then create a secondary one to load the sub-reports, and for each sub-report, I write a loop that for every page found in the sub-report, I create a mirrored page in the main report.
    I have a huge report made of several chapters, with the TOC, and it works beautifully.
    I cant give you much details, but the basic idea is this:

    Create MainRpt:TfrxReport ;
    Create SubRpt:TfrxReport ;

    repeat the block below for every subreport:
    SubRpt.Loadfromfile(filename);
    for each page in SubRpt (disconsider the Data page) begin
    SubRpt.page.savetostream(AnyStream);
    subPage := MainRpt.CreateNewPage;
    subPage.LoadFromStream(AnyStream);
    end;

    MainRpt.Show(true);

    In this case, you consolidated all report objects into only 1, much easier to mantain, I doubt your Anchors won't work if they were already working inside each individual subreport.
    Plus, you will be able to save the final report into one file (fr3) too.
    Oh, by the way, that's not about the export to PDF problem, I don't know anything about that one, sorry.
    Good luck

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.