How to extract text from html file?

Can anyone please give a sample code to extract text from a html file and save as text file?
The extracted text should not contain html tags but only the content that is displayed when the html file is viewed in browser should be extracted.

Thanks

@Sathiya22

You can use following code example to convert HTML to TXT file format. Please read following article for document conversion.
Convert a Document

Document doc = new Document(MyDir + "input.html");
doc.Save(MyDir + "output.txt", SaveFormat.Text); 

If you still face problem, please ZIP and attach your input HTML and expected output TXT documents here for our reference. We will then guide you according to your requirement.