Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How To Output a Report directly to HTML
Message
De
06/11/2008 10:39:41
 
 
À
06/11/2008 00:29:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MySQL
Divers
Thread ID:
01360087
Message ID:
01360183
Vues:
21
>Hi Experts,
>
>Any beginner's material and/or downloadable stuff, or better yet, classes on how to send a report directly to an HTML page?
>
>In an HTML page, does a user have capability to print with Excel-like features (shrink to fit page, change page orientation)?
>
>Reason I am thinking of doing this is because the resulting report can have variable number of columns, which our good ol' REPORT FORM doesnt seem to handle (or can it?).
>
>Thanks for any ideas, help and/or suggestions.
>
>Dennis

Use your code to create a string containing your html code, the use STRTOFILE() to save it out to an html file. Like this:
*******************************************************************************************
***	Program:	appendix5_2_html_revised.prg
***	Author:		Don W. Freeman
***	Date:		July 15, 2003
***	Copyright:	All rights reserved
***	Synopsis:	This program will create an HTML file containing the TIP Appendix 5 listing.
***				Projects are sorted based on the current order setting.
***
********************************************************************************************
appendix="Appendix 5"
ctipyear = alltrim(str(tipyear))

savefile = putfile("Save as:",ctipyear+"TIPAppendix5.htm","htm|html")
if empty(savefile)
	return
endif

set alternate to (savefile)
set alternate on
set console off

? "<html>"
? "<head>"
? "<title>TIP WEB PAGE APPENDIX 5</title>"
? "</head>"
********************************************************************
*	* this section for PAG site only
*	? "<DIV align=left>"
*	? "<TABLE cellSpacing=0 cellPadding=0 width=100% border=0>"
*	? "<TBODY>"
*	? "<TR>"
*	? "<TD width=100%><MAP name=FPMap0><AREA shape=RECT coords=4,13,73,73"
*	? "href=http://www.pagnet.org:444/webcreate/tpd/paghome.htm></MAP><IMG"
*	? "height=77 src=Pima Association of Governments_files/MainHeaderII.gif"
*	? "width=720 useMap=#FPMap0 border=0></TD></TR></TBODY></TABLE></DIV>"

******************************************************************************
? "<P align=center><font size=5 face=Arial color=red><strong><br>"
? "Transportation Improvement Program<br>"
? "FY" + allt(str(tipyear)) + " - " + allt(str(tipyear+4)) +"<br>"
? appendix + " - PREVIOUS TIP PROJECTS OBLIGATIONS and DRAWDOWNS</strong></font></p>"

? "<table border=1 cellspacing=0 cellpadding=4 width=750>"

? "<tr>"
? "<td valign=top align=center><font size=2>TIP<br>ID</font></td>"
? "<td valign=top align=center><font size=2>State<br>ID</font></td>"
? "<td valign=top align=center><font size=2>Project Name</font></td>"
? "<td valign=top align=center><font size=2>Drawdowns/Obligations</font></td>"
? "<td valign=top align=center width=80><font size=2>Amount</font></td>"
? "<td valign=top align=left><font size=2>Project<br>Sponsor</font></td>"
? "</tr>"

select appendix5
index on st_name to temp
go top
set console off
set talk off
do while  ! eof()
	scatter memvar
	thisrec = recno()
	set filter to tip_id = m.tip_id
	sum amount to x0 for fisyear = tipyear
	sum amount to x1 for fisyear = tipyear-1
	sum amount to x2 for fisyear = tipyear-2
	sum amount to x3 for fisyear = tipyear-3
	sum amount to x4 for fisyear = tipyear-4
	sum amount to x5 for fisyear = tipyear-5
	sum amount to x6 for fisyear = tipyear-6
	sum amount to x7 for fisyear = tipyear-7
	sum amount to x8 for fisyear = tipyear-8
	sum amount to x9 for fisyear = tipyear-9
	if x0<>0 or x1<>0 or x2<>0 or x3<>0 or x4<>0 or x5<>0 or x6<>0 or x7<>0 or x8<>0 or x9<>0
		? "<tr>"
		? " <td align=center><font size=2>" + alltrim(str(m.tip_id,7,2)) + " </font></td>"
		? " <td align=center><font size=2>&nbsp" + alltrim(m.state_id) + "</td>"
		? " <td align=left><font size=2>" + alltrim(m.st_name) + "</td>"
		? " <td align=left><font size=2>"
		if x9<>0
			? "Total for FY" + alltrim(str(tipyear-9)) + "<br>"
		endif
		if x8<>0
			? "Total for FY" + alltrim(str(tipyear-8)) + "<br>"
		endif
		if x7<>0
			? "Total for FY" + alltrim(str(tipyear-7)) + "<br>"
		endif
		if x6<>0
			? "Total for FY" + alltrim(str(tipyear-6)) + "<br>"
		endif
		if x5<>0
			? "Total for FY" + alltrim(str(tipyear-5)) + "<br>"
		endif
		if x4<>0
			? "Total for FY" + alltrim(str(tipyear-4)) + "<br>"
		endif
		if x3<>0
			? "Total for FY" + alltrim(str(tipyear-3)) + "<br>"
		endif
		if x2<>0
			? "Total for FY" + alltrim(str(tipyear-2)) + "<br>"
		endif
		if x1<>0
			? "Total for FY" + alltrim(str(tipyear-1)) + "<br>"
		endif
		if x0<>0
			? "Total for FY" + alltrim(str(tipyear)) + "<br>"
		endif
		
		? "Grand total <td align=right><font size=2>"
		
		if x9<>0
			? "$" + str(x9) + "<br>"
		endif
		if x8<>0
			? "$" + str(x8) + "<br>"
		endif
		if x7<>0
			? "$" + str(x7) + "<br>"
		endif
		if x6<>0
			? "$" + str(x6) + "<br>"
		endif
		if x5<>0
			? "$" + str(x5) + "<br>"
		endif
		if x4<>0
			? "$" + str(x4) + "<br>"
		endif
		if x3<>0
			? "$" + str(x3) + "<br>"
		endif
		if x2<>0
			? "$" + str(x2) + "<br>"
		endif
		if x1<>0
			? "$" + str(x1) + "<br>"
		endif
		if x0<>0
			? "$" + str(x0) + "<br>"
		endif
		total = x0+x1+x2+x3+x4+x5+x6+x7+x8+x9
		? "$" + str(total) + "</font></td>"
		? " <td align=center><font size=2>" + alltrim(m.lead) + "</font></td>"
	endif
	set filter to
	goto thisrec
	do while tip_id = m.tip_id
		skip
	enddo
enddo

? "</table>"

? "</body>"
? "</html>"


set alternate off
set alternate to
set console on
set talk on
messagebox("The HTML file has been created.",64)
return
This example uses an alternate method of creating the output file using SET ALTERNATE but you should get the idea.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform