Questions

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

+
1 Votes
Locked

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

bluenavy
I have a .txt file which contains HTML code. Can I convert this file to an HTML document? Thanks.
  • +
    1 Votes
    rayvyn

    just change the file extension to .htm or .html

    +
    0 Votes
    bluenavy

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

    +
    0 Votes
    rayvyn

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

    +
    2 Votes

    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?

    +
    1 Votes
    a.portman

    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.

    +
    2 Votes
    msimon

    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!

    +
    0 Votes
    Spitfire_Sysop

    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

    +
    0 Votes
    msimon

    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

    +
    0 Votes

    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

    +
    0 Votes
    mike.laing

    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!)

    +
    1 Votes
    Spitfire_Sysop

    An HTML file is text. You say that it "contains" html so just open it up and double check that it actually has the structure of an HTML document. There are rules. See here:
    http://www.techrepublic.com/blog/webmaster/html5-creating-a-base-template/492?tag=content;siu-container

    +
    0 Votes
    bluenavy

    I sincerely appreciate the responses but I am so completely confused that I cannot think straight. My fault. I think I should have provided more facts.

    My online bookmark storage place is going out of business. They sent me a file called export.html.txt . I opened the file. It contains, in html, my bookmarks. They said this file can be used to import the bookmarks into IE8. I went through the procedure to import the bookmarks into IE8 but it didn't work. Only a few category names (e.g., sports, weather, etc.) made it to the Favorites file in IE8 but no bookmarks carried over.

    Again, any assistance here would be appreciated. Thanks.

    +
    0 Votes
    Mehul Bhai

    Change the file name from export.html.txt to export.html by removing inly the .txt part of the file extension and retry the procedure.

  • +
    1 Votes
    rayvyn

    just change the file extension to .htm or .html

    +
    0 Votes
    bluenavy

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

    +
    0 Votes
    rayvyn

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

    +
    2 Votes

    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?

    +
    1 Votes
    a.portman

    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.

    +
    2 Votes
    msimon

    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!

    +
    0 Votes
    Spitfire_Sysop

    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

    +
    0 Votes
    msimon

    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

    +
    0 Votes

    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

    +
    0 Votes
    mike.laing

    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!)

    +
    1 Votes
    Spitfire_Sysop

    An HTML file is text. You say that it "contains" html so just open it up and double check that it actually has the structure of an HTML document. There are rules. See here:
    http://www.techrepublic.com/blog/webmaster/html5-creating-a-base-template/492?tag=content;siu-container

    +
    0 Votes
    bluenavy

    I sincerely appreciate the responses but I am so completely confused that I cannot think straight. My fault. I think I should have provided more facts.

    My online bookmark storage place is going out of business. They sent me a file called export.html.txt . I opened the file. It contains, in html, my bookmarks. They said this file can be used to import the bookmarks into IE8. I went through the procedure to import the bookmarks into IE8 but it didn't work. Only a few category names (e.g., sports, weather, etc.) made it to the Favorites file in IE8 but no bookmarks carried over.

    Again, any assistance here would be appreciated. Thanks.

    +
    0 Votes
    Mehul Bhai

    Change the file name from export.html.txt to export.html by removing inly the .txt part of the file extension and retry the procedure.