Marla,
You could take advantage of one of the few improvements that were added to the report writer in VFP. VFP allows you to call functions at various events. There are OnEntry and OnExit events for the title band, groups, detail, page, etc.
You could create a table of contents by calling a UDF from the following events:
Title.OnEntry( TOC("Init") )
GroupHeader.OnEntry( TOC("From", _PAGENO, GroupCaption) )
GroupFooter.OnExit( TOC("To", _PAGENO) )
The UDF TOC() creates a cursor and updates the cursor with the caption and page numbers. This concept could be enhanced to support different levels of groups, etc.
HTH
Here's the code for TOC:
LPARAMETER tcAction, tnPageNo, tcGroupCaption
LOCAL lnSelect
lnSelect = SELECT()
IF UPPER(tcAction) = "INIT"
CREATE CURSOR TOC (cGroup C(50), nFrom N(3), nTo N(3))
ELSE
IF UPPER(tcAction) = "FROM"
INSERT INTO TOC VALUES(tcGroupCaption, tnPageNo, 0)
ELSE
REPLACE toc.nTo WITH tnPageNo IN toc
ENDIF
ENDIF
SELECT (lnSelect)
RETURN ""
>Hi Everyone,
>I have to create a table of contents from a printed report.
>The way I *thought* I solved this was by 1st printing the report
>(repo form report1.frx to printer prompt preview).
>Then writing a slightly modified report to a text file
>(repo form report2.frx to rpt.txt ascii)
>
>report2.frx has "text identifiers" like 'GROUP TITLE' & 'PAGE NUMBER'
>with the fields I want to capture for the table of contents. I
>open the text file, capture the text after "GROUP TITLE" & "PAGE
>NUMBER" to use to create the TOC.
>
>But the problem I noticed was that the text file & printed report
>have different spacing and throws off how many pages print (i.e. "group
>title" B will be on page 4 of the printed report, & the text file has B starting on page 6, etc)
>
>Maybe there's another way to go about creating this TOC?
>Help anyone?
>Thanks in advance,
>~Marla
Daniel