Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP6 Writing HTML reports

Status
Not open for further replies.

button71

Programmer
Nov 8, 2006
69
AU
I provide a comprehensive set of reports of a catalogue from my app in :-

FoxPro
MSWord
HTML

For the last few years the HTML has been satisfactorily written by this type of code snippet from one of the many prg files handling different data elements in the catalogue table

Code:
*!* gnMyHTMLNo is the handle for the page already created

=FWRITE(gnMyHTMLNo,(bwpara)+chr(13)+'<hr>')

*!*FONT.SIZE = 12  && body text in (myfontHTML)

=FWRITE(gnMyHTMLNo,'<font size="'+ ( myfontHTML)+'">')+ ( myfontHTML)+'">')


=FWRITE(gnMyHTMLNo,chr(13))
=FWRITE(gnMyHTMLNo, 'Record   :    '+'   :    ')  

=FWRITE(gnMyHTMLNo,'<b>'+ALLTRIM(str(nextrecord,5,0))+'</b>')
=FWRITE(gnMyHTMLNo,chr(13))
=FWRITE(gnMyHTMLNo,'_____'+ (itemname) +'  : ') && Exhibit Number

=FWRITE(gnMyHTMLNo,'<b>' + (itemnumber ) + '</b>')


=FWRITE(gnMyHTMLNo,chr(13))

=FWRITE(gnMyHTMLNo,'_____'+(ItemType)+'   : ')
=FWRITE(gnMyHTMLNo,'</font>'+chr(13))
=FWRITE(gnMyHTMLNo,'<span style="font-variant: small-caps"><font size="'+ (myfontHTML)+'">')


=FWRITE(gnMyHTMLNo,'</font></span>')

In one long page I am loosing the font definition after say record 26 so I would like to convert to a style sheet system but am not sure how I would write out the page tags.

Has anyone any examples of some code doing this?

Regards

William
 
Yes. I have faq184-4704 as well as a custom html report writer which constructs the header, scripts, footer, formatting, table nests, divs etc using dynamically called procedures, but I think your question is more of an HTML one than how to make VFP generate the HTML.

Check out forum215, but for the most part, find pages/reports that looks like what you want to make and 'view source'.

Brian
 
The method required will be similar to creating dynamic pages for the web. There are a few way of doing it but I prefer using templates, ones you create yourself rather than the ones you download and spend hours getting them to work.
Create a blank template in a HTML editor or notepad if you know HTML. Put comments in the HTML (each on a seperate line)where you want the content to go ie.
Code:
<!-- ITEM AND CODE -->
<!-- DESCRIPTIONS AND PRICES -->
<!-- TOTALS -->
Save it as a .HTM file.
In VFP, write a routine which opens the document up and writes to a new document line by line.
Each line is checked for the existence of one of your comments and if a match is found, run a routine which prints your information into that cell/div. The HTML formatting is already done and is kept seperate from your VFP code, you just have to manage the dynamic content.


Keith
 
In VFP, write a routine which opens the document up and writes to a new document line by line.

I use a similar technique to create our own web pages but I use FILETOSTR, STRTRAN, and STRTOFILE rather than the low-level commands. These read the template into a string, convert the placeholders into text, images or links as appropriate, and then write the string out to a new html document.

Geoff Franklin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top