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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prinitng HTML Using Vb

Status
Not open for further replies.

UZN

Programmer
Oct 15, 2010
5
US
Hi,

I'm running a VB script that prints the error file using DOS and it is p,lain tetxt file. I want it to be more informative. I want to print the error file in HTML format with or without pictures. Would be appreciative if you could place a smaple code here .

Thanks.
 
A sample of what exactly?

It's just exactly the same as writing a text file, only with a .htm(l) extension rather than .txt and markup tags around the text you want to format.


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
 
here is the code where i want to show a picture or details in html format:
writer = New StreamWriter(outFile)

writer.WriteLine("--------------------------------------------------------------------")
writer.WriteLine(" Failed Order")
writer.WriteLine("---------------------------------------------------------------------")
writer.WriteLine(" ")
writer.WriteLine(" ")
writer.WriteLine("A ROES error file was found for a recent order.")
writer.WriteLine(" ")
writer.WriteLine(" ")
writer.WriteLine("File Name : " & temp)
writer.WriteLine("Current Date : " & today & " - " & curTime)
writer.WriteLine(" ")
writer.WriteLine(" ")
writer.WriteLine("No other data is available for this order. ")
writer.WriteLine(" ")
writer.WriteLine(<a href="C:\Documents and Settings\unikhath\Desktop.sunset.jpeg"></a>)
writer.WriteLine("---------------------------------------------------------------------")
writer.Close()
Threading.Thread.Sleep(1000)


instead of plain text i want to show images of the order or more details in pdf format or in html format. i tried using the reference for the image but doesnt work. It simply shows the path of the image in the output.
Any help is greatly appreciated
 
Try changing this
Code:
writer.WriteLine(<a href="C:\Documents and Settings\unikhath\Desktop.sunset.jpeg"></a>)
to
Code:
writer.WriteLine("<a href= & chr(34) & C:\Documents and Settings\unikhath\Desktop.sunset.jpeg & chr(34) & ></a>")
 
Sorry jges, that doesnt work either. the path is printing in the output not the image.
 
> i want to show a picture or details in html format

>that doesnt work either. the path is printing in the output not the image

I think you might need to do a little bit of research on what HTML actually is.

1) Without going into the details right here (there's plenty of info and introductory guides on the 'net), HTML is merely a description of how you might want to display something. The actual display is carried out by an application that understands how to interpret and render that description - such as a web browser.

2) jges has shown how to insert an HTML link into your text file - but it is pretty useless as there is no associated text, so no link will appear even if you do display it in a web browser. The HTML tag you actually want is [tt]img[/tt]

3) HTML interpreters are fairly forgiving, so we don't have to re-express the entire outpur in HTML (although we probably should)

So, change your

writer.WriteLine(<a href="C:\Documents and Settings\unikhath\Desktop.sunset.jpeg"></a>)

to

writer.WriteLine(<img src="C:\Documents and Settings\unikhath\Desktop.sunset.jpeg" alt="Text incase" />)


and then load the outoput into a webbrowser ...


BTW - StreamWriter and Threading look rather like VB.NET to me, not VBScript ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top