|
-
Mar 9th, 2002, 09:09 PM
#1
Thread Starter
PowerPoster
Well Printing to HTML (not printing a HTML Page)
How would I take a group of database records and create a HTML page from them (I would like to do without going thru Access, if possible)...
Basically, my real goal would be able to print custom reports I made user Printer.print and then give the user the option as saving this report in HTML (WYSIWYG fromat).
Any ideas? Is this far-etched?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 9th, 2002, 09:33 PM
#2
very, very, very simple example...
VB Code:
Private Sub GenerateHTML(rs As RecordSet)
Dim s As String
Dim fld As Field
s = "<html>"
With rs
If .RecordCount > 0 Then
.MoveFirst
s = s & "<table border=""1"">"
While Not .EOF
s = s & "<tr>"
For Each fld In rs.Fields
s = s & "<td>" & fld.Value & "</td>"
Next fld
s = s & "</tr>"
.MoveNext
Wend
s = s & "</table>"
End If
End With
s = s & "</html>"
WebBrowser1.Document.documentElement.innerHTML = s
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 9th, 2002, 09:59 PM
#3
Thread Starter
PowerPoster
crptcblade: Thanks for replying...
WebBrowser1.Document.documentElement.innerHTML = s
A webrowser control is necessary?
Is there a way to format it exactly the way I want it to look?
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 9th, 2002, 10:02 PM
#4
No, a WebBrowser isn't necessary, I just figured I'd throw it in there as a way to view it. You can save it to an HTML file and view/print it some other way.
To format it how you want it, you'll have to check the data, and add html tags where needed.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Mar 9th, 2002, 10:05 PM
#5
Thread Starter
PowerPoster
Well
Have you ever run across a tutorial on this subject? Any of the other VB sites perhaps? I'm looking for examples of different methods, since my knowledge with HTML tags is lacking...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 12th, 2002, 09:40 AM
#6
Member
crptcblade, how do you use the .documentElement.innerHTML? I don't see any properties of WebBrowser1.Document and .Document is shown as read-only.
VB Code:
WebBrowser1.Document.documentElement.innerHTML = s
Thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|