Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I need to convert dbf to html
Message
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
01649884
Message ID:
01650684
Views:
58
>Can anyone suggest a simple way of converting a dbf to html
>
>I need to be able to run it as an unattended scheduled service every night

Not to be dense, but you do know how to generate a text string concatenating strings right? Just loop through the table and write out each row as a text string.
USE myTable
TEXT to lcHTML
<table>
<tr>
<th>col1</th><th>col2</th>
</tr>
ENDTEXT

SCAN
    lcHtml = lcHtml + "<tr>" + CHR(13) + CHR(10) +;
                 "<td>" + TRANS(col1) + "</td><td>" + TRANS(col2) + "</td>" + CHR(13) + CHR(10) +;
                 </tr>" + CHR(13) + CHR(10)
ENDSCAN

lcHtml  = lcHtml + "</tr>" + CHR(13) + CHR(10)

STRTOFILE(lcHtml,"c:\temp\htmltable.html")

* GoUrl("c:\temp\htmltable.html")
Obviously you'll need to do a little more work for formatting perhaps or wrap into a template.

If you use West Wind Tools, you can use the HtmlDataGrid class to generate the HTML generically from your table, and use other tools like wwScripting to dynamically create the HTML page and embed the grid (and any other data) into the template.

* HtmlDataGrid
* wwScripting




+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform