2016-05-12 66 views

回答

1

我发现这个链接 http://www.adhocgeek.com/2012/11/sending-ssrs-generated-mhtml-with-system-net-mail/

将溶液以提取编码为MHTML内的Base64的HTML的溶液。

var decoded_text = new StringBuilder(); 
using (var reader = new StreamReader(mhtFile)) 
{ 
    while (!reader.EndOfStream) 
    { 
     var line = reader.ReadLine(); 
     if (line != "Content-Transfer-Encoding: base64") continue; 

     reader.ReadLine(); //chew up the blank line 
     while ((line = reader.ReadLine()) != String.Empty) 
      if (line != null) 
       decoded_text.Append(
        Encoding.UTF8.GetString(
         Convert.FromBase64String(line))); 
     break; 
    } 
} 
0

我打开.mhtml从该页面在文本编辑器(记事本+ +)时,HTML似乎是在该文件中,完整。您必须向下滚动浏览所有CSS。我只是创建一些东西来从文件中提取HTML文本,而不是处理base64数据(如果某些东西不能正常工作,对我来说太困难了)。