WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

User Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Quickly display HTML text as HTML

 Keywords: Display HTML text 

Question:

Suppose I have a hunk of text in a WB variable, like this (in the below I have replaced left brackets with left parens):
<html><pre>
<span style='color:green'>Some text here: -</span>
etc, etc.
I want to display this to the user as it would appear on a web page.

Things I've considered, but rejected as being too involved/time-consuming: 1) Writing it out to a file and loading it into Word. 2) Writing it out to a file and loading it into a web browser.

I have a clipboard util running on my desktop that can do this easily, but again, that's more involved than I want to get. Is there some other commonly available utility that can do this? Or, is there something built into WB that can do it? Note: I think that dialogs now have this capability, but I am kind of naive about the more recently-added (like in the last 3 years) capabilities of dialogs, so go easy on me, OK?

Answer:

strHtml = ""
strHtml = StrCat (strHtml, '<html><head><title>Test Result</title></head><body><table border="1"><colgroup width="*" span="3"></colgroup>')
strHtml = StrCat (strHtml, '<tr><th colspan="3">Hello World!</th></tr><tr><th>One</th><th>Two</th><th>Three</th></tr>')
strHtml = StrCat (strHtml, '</table></body></html>')
oIE = ObjectCreate ("InternetExplorer.Application")
oIE.navigate ("about:blank")
oIEDoc = oIE.Document
oIEDoc.write (strHtml)
oIE.visible = @TRUE
;oIE.quit
Exit

Article ID:   W18143
Filename:   Quickly display HTML text as HTML.txt
File Created: 2008:10:28:09:24:34
Last Updated: 2008:10:28:09:24:34