添加引用Microsoft.mshtml
然后
Microsoft.mshtml
 private void btnTest_Click(object sender, EventArgs e)
        
{
            System.IO.StreamReader stream 
= new System.IO.StreamReader("c:\\test.htm",System.Text.Encoding.Default);
            
string content = stream.ReadToEnd();
            stream.Close();

            IHTMLDocument2 doc 
= GetDoc2(content);
            doc.title 
= "新Tile";

            StreamWriter writer 
= new StreamWriter("c:\\test.htm"false, System.Text.Encoding.Default);
            writer.Write(doc.body.parentElement.innerHTML);
            writer.Close();

            
//MessageBox.Show();
           
            
            
        }

        
public IHTMLDocument2 GetDoc2(string strHtml)
        
{
            mshtml.IHTMLDocument2 doc 
= null;
            
if (strHtml == string.Empty)
                
return doc;

            doc 
= new mshtml.HTMLDocumentClass();
            doc.designMode 
= "On";
            doc.write(strHtml);
            
            
return doc;
        }