1 /// <summary> 2 /// 讀取html裡面的body內容(不包括<body>標簽) 3 /// </summary> 4 /// <param name="htmlUrl">要讀取的html地址</param> 5 private string ReadHtmlToEditHtml(string htmlUrl) 6 { 7 string htmlContent1 = string.Empty; 8 using (StreamReader reader = new StreamReader(htmlUrl)) 9 { 10 htmlContent1 += reader.ReadToEnd(); 11 } 12 Regex reg = new Regex("(?is)<body[^>]*>(?<body>.*?)</body>"); 13 string bodyHtml = ""; 14 bodyHtml = reg.Match(htmlContent1).Groups["body"].Value; 15 return bodyHtml; 16 }