Question

Locked

How do I convert a .txt file which contains HTML code to an HTML document?

By bluenavy ·
I have a .txt file which contains HTML code. Can I convert this file to an HTML document? Thanks.

This conversation is currently closed to new comments.

18 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Just change the file extension

by rayvyn In reply to How do I convert a .txt f ...

just change the file extension to .htm or .html

Collapse -

I already tried that. It didn't work.

by bluenavy In reply to How do I convert a .txt f ...

Thank you but I already tried that. It didn't work.

Collapse -

Reponse To Answer

by rayvyn In reply to I already tried that. It ...

could you post some examples so i can take a look?

Collapse -

Chang the extension

As rayvyn said, change the extension, but make sure that explorer is set to display extensions for known file types, otherwise it will end up as .html.txt But , just having some html code doesn't make it an html page. Is it a well formed html page? with the opening and closing tags correct. What happens when you try to open it with IE?

Collapse -

Other options

by a.portman In reply to How do I convert a .txt f ...

1. Rename it at the command line. go to run, run cmd. navigate to the file (or move it to the root of C: for a minute. Then, ren name.txt name.html.

2. Open with Word, you save as html.

Collapse -

Converting a .txt file which contains HTML code

by msimon In reply to How do I convert a .txt f ...

Navy,
I'm afraid Brian and Rayvin are as my old boss used to say, "off by half a bubble." Please excuse me if you've never used a carpenter's level. I digress. So, take any web page... this one perhaps.. and right click on some text area, then click on "View source". Then copy the first line <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> and copy it to your document. Be sure <html > appears at the top of the page, and </html> appears at the bottom. Then SAVE AS whatever you like, being sure you have selected SAVE AS TYPE = ALL. If you are the kind of guy who uses suspenders and belts at the same time, you could use quotation marks, like: "mywebpage.htm". The key is just be sure you are not saving as txt. That's what they were trying to say. Go Navy!

Collapse -

Reponse To Answer

by Spitfire_Sysop In reply to Converting a .txt file wh ...

If they are off by half then you would be off by a quarter. Go check out HTML5 markup. It is much shorter and so easy that a child can learn it in a few minutes. See here:
http://www.techrepublic.com/blog/webmaster/html5-creating-a-base-template/492?tag=content;siu-container

Collapse -

convert a .txt file which contains HTML code

by msimon In reply to How do I convert a .txt f ...

Yikes I skrewed up (carpenter lingo agin) Wen I said be sure it appears at the top and at the bottom I must have hit the Control and not the Shift. The sentence should read: "Be sure < H T M L >appears at the top of the page, and < / H T M L >appears at the bottom". html&/html are special reserved words so I can use the braces in an email, but you get the idea. Just don't add all those s p a c e s that I did

Collapse -

It's been a few years, but...

back when my DOS usage was a bit more, I used a command-line utility called
TXT2HTM...just creates a simple page. Don't know if it runs in a CMD.EXE
box on NT or not, might be worth a try...you can get a copy from here:
http://www.resoo.org/docs/dos/free_software/html.htm#txt2htm1

Collapse -

preserve html code as text

by mike.laing In reply to How do I convert a .txt f ...

Open the text file with IE or Firefox. You can use the right click context menu on the .txt file and 'open with', or drag and drop txt file into open browser window. Then File->Save as and select 'Web Page, html only" or 'All files". With all files, you have to manually add '.htm(l)' to the name.
However, I accomplish the same thing just renaming the txt file to a .htm. They both result in the html code being rendered by the browser, for instance < a href > stuff becomes an active link, etc.
If you want to preserve the html code as text in an html document, add this one tag at the beginning of the text: <'pre'> and at the end, <'/pre'>(without the ' in then) and then just 'save as web page' or rename the file with the .html extension.
(LOL, I had a heck of a time getting my pre tags to show, they get rendered!)

Back to Software Forum
18 total posts (Page 1 of 2)   01 | 02   Next

Software Forums