简体   繁体   English

从mht中提取文本

[英]extract text from mht

I have an mht file, I wish to get all the text of the mht. 我有一个mht文件,我希望得到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... 我考虑使用正则表达式,但除了英语之外我还有mht中的其他语言,所以文本本身包含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. 选择浏览器中查看的文件的所有文本,然后将其复制并粘贴到记事本中 - 这就是我需要的。

Thanks. 谢谢。

Open the file in Internet Explorer and save it as plain text (UTF-8). 在Internet Explorer中打开该文件并将其另存为纯文本(UTF-8)。 :) If you need an automated solution, look for an mht to txt converter for your platform or programming language. :)如果您需要自动化解决方案,请为您的平台或编程语言寻找mht to txt转换器。

Actually, you can automate this in Powershell as well: 实际上,您也可以在Powershell中自动执行此操作:

$ie = New-Object -ComObject "InternetExplorer.Application"
$ie.Navigate2("file:///C:/MyFile.mht")
$text = $ie.Document.documentElement.innerText

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM