Html opens as text file

How to convert an HTML document to a text document

Currency conversion.

Computer Hope

A web page is made up of plain text and HTML (hypertext markup language) programming code that is used to load pictures and basic formatting of text (e.g., bold, italics, and color). To preserve the spacing and formatting on a web page, it is often saved with a .HTM or .HTML file extension. However, there may be a need to save the text on the web page as a text document or file. Below are several methods for converting, or saving, an HTML web page as a text document.

Copy and paste web page text in a text document

To save the text on a web page as a text document, follow the steps below.

  1. Access the web page containing the text you want to save as a text document.
  2. Highlight the text on the web page that you want to save in a text document.
  3. Copy the highlighted text.
  4. Open a text-based application, like Notepad.
  5. In the text application, paste the text you copied.
  6. Save the file, creating the text document.

Save HTML web page as a text document (losing HTML code)

To save the text, and any formatting of the text, as a text document, follow the steps below.

Microsoft Word must be installed on your computer to utilize the steps below.

  1. Access the web page you want to save as a text document.
  2. Save the web page as a web page file (.HTM or .HTML file extension). See the details below on how to save the file in Internet Explorer, Google Chrome, and Mozilla Firefox.

Internet Explorer

  • Press the Alt to make the File/Edit/View menu visible. Click the File menu and select Save as.
  • Select the location where you want to save the web page file and make sure the Webpage, complete option is selected in the Save as type drop-down list.
  • Click the Save button.

Save as type option

Google Chrome

  • Right-click the web page and select the Save as option.
  • Select the location where you want to save the web page file and make sure the Webpage, complete option is selected in the Save as type drop-down list.
  • Click the Save button.

Mozilla Firefox

  • Right-click the web page and select the Save Page As option.
  • Select the location where you want to save the web page file and make sure the Webpage, complete option is selected in the Save as type drop-down list.
  • Click the Save button.
Читайте также:  Python set root directory

In Firefox, instead of selecting the Webpage, complete Save as type option, you can select the Text Files option to save the web page directly to a text document.

  1. Open the Microsoft Word application.
  2. Click the File tab, then click the Open option.
  3. Next to the File name field, in the file type drop-down list, select the All Web Pages option.
  4. Browse to find the web page file you saved from above. Select the file and click the Open button.

Microsoft Word - open file

  1. Click the File tab again, then click the Save as option.
  2. In the Save as type drop-down list, select the Plain Text (*.txt) option. Additionally, you may need to change the file extension in the File name field to be txt, if it does not automatically change.
  3. Click the Save button to save as a text document.

Microsoft Word - Save as type

Convert HTML file to a text file (preserving HTML code and text)

To save a web page as a text document, and preserve the HTML code that provides formatting of the text, follow the steps below.

While the resulting file is a text file, it contains HTML programming code with the text.

  1. Access the web page you want to save as a text document.
  2. Save the web page as a web page file (.HTM or .HTML file extension). See the details below on how to save the file in Internet Explorer, Google Chrome, and Mozilla Firefox.

Internet Explorer

  • Press the Alt to make the File/Edit/View menu visible. Click the File menu and select Save as.
  • Select the location where you want to save the web page file and make sure the Webpage, complete option is selected in the Save as type drop-down list.
  • Click the Save button.

Internet Explorer Save as type option

Google Chrome

  • Right-click the web page and select the Save as option.
  • Select the location where you want to save the web page file and make sure the Webpage, complete option is selected in the Save as type drop-down list.
  • Click the Save button.

Mozilla Firefox

  • Right-click the web page and select the Save Page As option.
  • Select the location where you want to save the web page file and make sure the Webpage, complete option is selected in the Save as type drop-down list.
  • Click the Save button.

In Firefox, do not select the Text Files Save as type option, as it only saves the text on the web page and does not preserve the HTML code.

  1. Right-click the saved web page file and select the Open with option.
  2. In the Open with menu that appears, select the Choose another app option.
  3. Find and select the Notepad program in the list of applications, then click the OK button.
  4. Once Notepad is open with the HTML code, click File, then Save as, choose the location where you want to save the file, then click the Save button to save as a text document.
Читайте также:  Html цвет телесный цвет

Источник

How to Convert HTML to Plain Text

HTML (Hypertext Markup Language) is used to create Web pages. It is text based but includes «tags» that define how text on a Web page is displayed. But because the HTML codes are hidden by the Web browser, you can copy the viewable text from the browser window and paste it into any application that accepts text, such as the free editor included with Windows (Notepad) or Macintosh OSX (TextEdit). Some Web browsers can also save HTML pages as text without the tags.

Save As Text with Web Browser

Open the HMTL document or Web page you want to convert to text in your Web browser software.

Click the File menu and select «Save As» (or page menu and «Save As» in Internet Explorer).

Choose «Text Pages» from the drop-down format menu and choose a destination for the text file.

Click «Save,» then exit the browser and locate the text file you saved. You can open this in any application that can read a text file such as NotePad in Windows. Some text editors who read the saved HTML file might display it with no carriage returns or line breaks. If that happens, try the next method.

Copy and Paste to Notepad (Windows) or TextEdit (Macintosh)

Open the HMTL document or Web page you want to convert to text in your Web browser software.

Click and drag over the text you want to convert or press Ctrl+A (Command+A on Macintosh) to select the entire page.

Click the «Edit» menu, then «Copy.»

Open the Notepad application (Windows) or the TextEdit application (Macintosh) and click «Paste» under the «Edit» menu. You will now have the text contents of the Web page in the text editor window.

Click the «File» menu, then «Save As» to save the new document as a text file, and you will have successfully converted the Web page HTML to text.

  • A full-feature Web editing tool such as Adobe Dreamweaver can open an HTML page into a text-only view and has a command under the «Edit» menu that allows you to copy the text, not the tags. You could then paste that into another application. You can also copy and paste Web page content into word-processing software such as Microsoft Word. After pasting, click the «File» menu and select «Save As» («Office» menu, then «Save As» in Word 2007) and choose «Text Only» as the format for this document if you want to keep it in «plain text.» Otherwise, choose the word processor’s standard format (.doc for Word) and you will have a document that used to be HTML but is now text without the HTML codes.
  • The Safari Web browser does not have an option to save a Web page as a text-only document. Use the copy-and-paste method to convert the HTML to text.
Читайте также:  Php how to create functions

Katelyn Kelley worked in information technology as a computing and communications consultant and web manager for 15 years before becoming a freelance writer in 2003. She specializes in instructional and technical writing in the areas of computers, gaming and crafts. Kelley holds a Bachelor of Arts in mathematics and computer science from Boston College.

Источник

open HTML document as text file

Hello, I have a problem with my code. It currently works fine, by
searching through a directory, finding every .html & .htm, searching
through that file for any href’s, and then printing them into a
spreadsheet. The problem I have seemed to encounter though, is that
some files have the .html extension, but have IE icons, so the code
seems unable to search through the source code of them because if you
were to double click them they would simply come up in IE. Here is
some of the code that I have.

Globalindx = 1
‘MsgBox «Press OK to begin report»
Dim WholeLine As String
Dim myPath As String
Dim workfile As String
Dim myR As Long

Set fs = Application.FileSearch
With fs
.LookIn = «C:\Exelon»
.Filename = «.html»
.SearchSubFolders = True
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox «There were » & .FoundFiles.Count & _
» file(s) found.»
Application.ScreenUpdating = False
For i = 1 To .FoundFiles.Count

Next i
Application.ScreenUpdating = True
Else
MsgBox «There were no files found.»
End If
End With
End Sub

Sub ParseURL(strFile As String)
Dim strTxt As String, lngTxt As Long, i As Long, oMatches
Dim ws As Worksheet, j As Long, k As Long, m As Long, oMatches2
Dim reg, oMatches3, reg2, txtTitle, txtLinkName, txtLine
Dim re, matches, match, d, uri, name
i = FreeFile

lngTxt = FileLen(strFile)
strTxt = Space(lngTxt)
Open strFile For Binary Access Read As #i
Get #i, , strTxt
Close #i

Dim indx
indx = 1
Dim tst
tst = GetHrefs(strTxt, strFile, txtTitle)

Function GetURLAddress(ByVal TextToSearch) As String
Dim Start, Length
Start = InStr(1, TextToSearch, «href=», vbTextCompare) + 6
Length = InStr(1, TextToSearch, «»» «, vbTextCompare) — Start
If Length < 0 Then
Length = InStr(1, TextToSearch, «‘>», vbTextCompare) — Start
End If
If Length < 0 Then
GetURLAddress = «»
Else
GetURLAddress = LTrim(RTrim(Mid(TextToSearch, Start, Length)))
End If
End Function

Источник

Оцените статью