Search code examples
reportstimulsofttableofcontents

how to create a table of contents for multi-page Report in stimulsoft?


I've created a report by "Stimulsoft" in multiple pages (about 36-37). and every page has a report title. Now I want to create a Table of Contents that refers to every page report title and the number of that report title where it starts.

I tried AddAnchor() and GetAnchorPageNumber() Method from here but it's not working because the GetAnchorPageNumber() gets the last page number of the current page.

For example page No.3 will start from page number 3 and print in 6 pages (until page 9). GetAnchorPageNumber() will return the ending page 9 instead of the starting page 3.

Can anyone help how to create a Table of Contents in Stimulsoft by any means?


Solution

  • i'v created a report file with a title page, TOC and three pages:

    - title Page

    - table of contents

    - page 1

    - page 2

    - page 3

    page 1 will be printed in 12 sheets; page 2 in 9 sheets; page3 in 4 sheets.

    then i select page 1; in properties, fill (Alias) with title that i want to show in TOC. for example Sell Report.

    and then in event tab of page 1 select begin render and write {AddAnchor(Page1);}. actually i put a anchor in a list or stack or something else that record page 1's anchor. but the point is to do this in begin render event. if i write AddAnchore(); in rendering or end render event so i'll get the latest page number of page 1.

    alright!

    and do the same thing for page 2 and page 3:

    -fill alias with title.

    -fill begin render event with {AddAnchor(---page Name---);}

    now in table of contents page you should create two texts for header of TOC; that appears like this :

    title--------------------------------------------page no

    under the header make a data with no source. inside it you must to create two Texts For each page. one in left for page title and other in right for page number. in left one(page title) write {Page1.Alias} surely for every page you should type {---page name---.Alias}. then in right one(page number) write {GetAnchorPageNumber(Page1)} for others {GetAnchorPageNumber(---page name---)}.

    select right one Text(page Number), in properties set Process at property to End of Report.

    Finished!