C# – extract text from mht


I have an mht file, I wish to get all the text of the mht. I tought about using regex, but I have other languages in the mht except english, so the text itself contains stuff like A7=A98=D6…

select all the text of a file viewed in your browser, and then copy and paste it into a notepad – this is what i need.


Best Solution

Open the file in Internet Explorer and save it as plain text (UTF-8). :) If you need an automated solution, look for an mht to txt converter for your platform or programming language.

Actually, you can automate this in Powershell as well:

$ie = New-Object -ComObject "InternetExplorer.Application"
$text = $ie.Document.documentElement.innerText