Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joshi-kumar/47b5dd4acd3751db863d784ce762d073 to your computer and use it in GitHub Desktop.
Save joshi-kumar/47b5dd4acd3751db863d784ce762d073 to your computer and use it in GitHub Desktop.
Html file load changes and write in different file (read a html file)
string epubPath = "D://reader/epubs/test.html";
string epubPath1 = "D://reader/epubs/test1.html";
HtmlDocument doc = new HtmlDocument();
doc.Load(epubPath);
HtmlNode rootbody_node = doc.DocumentNode.Descendants("body").ElementAt(0);
HtmlNodeCollection body_elements = rootbody_node.ChildNodes;
if (body_elements.Count != 0)
{
body_elements[0].SetAttributeValue("id", "Reached");
}
doc.Save(epubPath1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment