Results 1 to 6 of 6

Thread: Well Printing to HTML (not printing a HTML Page)

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    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....

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    very, very, very simple example...
    VB Code:
    1. Private Sub GenerateHTML(rs As RecordSet)
    2. Dim s As String  
    3. Dim fld As Field
    4.  
    5.     s = "<html>"
    6.  
    7.     With rs
    8.         If .RecordCount > 0 Then
    9.             .MoveFirst
    10.             s = s & "<table border=""1"">"
    11.      
    12.             While Not .EOF
    13.                 s = s & "<tr>"
    14.                 For Each fld In rs.Fields
    15.                     s = s & "<td>" & fld.Value & "</td>"
    16.                 Next fld
    17.                 s = s & "</tr>"
    18.                 .MoveNext
    19.             Wend
    20.  
    21.           s = s & "</table>"
    22.         End If
    23.     End With  
    24.  
    25.     s = s & "</html>"
    26.  
    27.     WebBrowser1.Document.documentElement.innerHTML = s
    28.  
    29. End Sub

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441
    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....

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    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

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Aug 2000
    Location
    IN SILENCE
    Posts
    6,441

    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....

  6. #6
    Member
    Join Date
    Sep 2000
    Location
    Kentucky
    Posts
    56
    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:
    1. 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
  •  



Click Here to Expand Forum to Full Width