//Class for creating attachment public class Attachment { ///
/// Gets or sets the attachment content /// public byte[] Content { get; set; } }
result = System.Text.Encoding.UTF8.GetString(attachment.Content);
HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument(); //Load html
html.LoadHtml(result); //Remove html tag like css class,anchor tag (any link here) using Linq and finding css class
html.DocumentNode.Descendants().Where(x => (x.Attributes["class"] != null && x.Attributes["class"].Value.Contains("ClassName"))).ToList().ForEach(n => n.Remove());
result = System.Text.Encoding.UTF8.GetString(attachment.Content);
HtmlAgilityPack.HtmlDocument html = new HtmlAgilityPack.HtmlDocument(); //Load html
html.LoadHtml(result); //Remove html tag like css class,anchor tag (any link here) using Linq and finding css class
html.DocumentNode.Descendants().Where(x => (x.Attributes["class"] != null && x.Attributes["class"].Value.Contains("ClassName"))).ToList().ForEach(n => n.Remove());
No comments:
Post a Comment