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

End user report with TOC

edited January 2004 in End User
Is it possible to generate a Table Of Contents with RAP?
I am trying to adapt the IndexOfContents example but
1. If I use a simple memo in a summary band I am unable to expand it
2. I am trying to use values in a TStringList because I need index
entries alphabetically sorted. Is it possible to achieve this with the
only TppMemo component?
3. If I use a subreport (as in the example) i got compilation error
trying to access the memo in the subreport...

Help please!!

Tnx
Nicola

Comments

  • edited January 2004

    1. Set Memo.Stretch to True.

    2. Set Report.PassSetting to psTwoPass.

    3. You can try using a TStringList and then assigning it to the Memo.Lines
    in the before print event.

    4. In the module section of the main report's code module, declare a global
    variable, gMemo: TppMemo. In the child report's code module, use the report
    OnStartFirstPass event to initialize gMemo, gMemo := Memo1. Then in the main
    reports event-handlers you can use gMemo.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2004
    Well I already set Stretched=True but
    it seems that the TppMemo doesn't stretch over the first page

  • edited January 2004
    We made some testing and
    the problem seems a matter of timing.
    We set the TppMemo TOC contents in the AfterFirstPass event.
    It seems it is too late.
    If we change TppMemo contents by code in BeforeFirstPass then TppMemo
    stretches over more than one page correctly. (this TppMemo is with
    stretched = True in a summary band with dynamic height enabled)
    The problem, obviously, is that in the BeforeFirstPass we didn't know
    exactly our "contents".. We can try to put some empty space (to make
    room for the true index) but doing so leaves empty pages at the end (if
    we add too much)

  • edited January 2004
    After further testing...
    Even in your IndexOfContents example, if you force the memo contents to
    extend beyond the first page (I enlarged the font size) you will see
    that the memo doesn't extend on the next pages..
    For now we use the workaround of making manually some room in the
    TppMemo by code but it isn't a very good solution...

    BTW is it possible to format a TppMemo (or a band, a subreport) as a
    multi-column report (newspaper style)?

    Thanks!
    Bye
    Nicola
  • edited January 2004

    1. During the first pass all of the pagination for the report is determined.
    That is how the report engine works, there is no way around it. If you
    dyanmically build your list while the report is executing, perhaps you can
    use the SummaryBand.BeforePrint event to assign the index items to the
    TppMemo. This is the last place that you can assign the items to the TppMemo
    and have it stretch properly.

    2. Columns

    One approach would be to create one TppMemo to represent each column. Set
    each to stretch. In your code that builds the index you could divide the
    total number of items by the number of columns and then load the appropriate
    number of items into each memo.

    A subreport set pbChild will not print columns. A subreport set to either
    pbSection or pbFixed can print newspaper columns. A section always generates
    a page break before it starts and after it ends - probably not what you are
    looking for. A Fixed style subreport will print columns but have to size the
    subreport to occupy a fixed amount of page space, it will not stretch.






    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2004
    Is Nard a female name?
    Anyway I would like to kiss you, BeforePrint works fine!

This discussion has been closed.