Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to create table of contents from a report
Message
De
07/02/2001 05:07:03
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00473315
Message ID:
00473348
Vues:
18
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:
*  Program...........: TOC.PRG
*--------------------------------------------------------------------------------------------------
LPARAMETER tcAction, tnPageNo, tcGroupCaption

LOCAL lnSelect
lnSelect = SELECT()

IF UPPER(tcAction) = "INIT"
	*-- called from the report's title.onEntry( TOC("Init") )
	CREATE CURSOR TOC (cGroup C(50), nFrom N(3), nTo N(3))
ELSE
	IF UPPER(tcAction) = "FROM"
		*-- called from the report's groupHeader.onEntry( TOC("From", _PAGENO, GroupCaption) )
		INSERT INTO TOC VALUES(tcGroupCaption, tnPageNo, 0)
	ELSE
		*-- called from the report's groupFooter.onExit( TOC("To", _PAGENO) )
		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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform