using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Help.HelpSystem { public static class HelpHtmlWrapper { public static void Find(object Document, string text) { var doc = Document as mshtml.IHTMLDocument2; if (doc == null || doc.body == null || text == "") return; string html = doc.body.innerHTML; string temp = ""; int index = html.IndexOf(text, StringComparison.CurrentCultureIgnoreCase); while (index != -1) { int min = html.IndexOf('<', index); int max = html.IndexOf('>', index); if (min <= max) { temp = "" + html.Substring(index, text.Length) + ""; html = html.Substring(0, index) + temp + html.Substring(index + text.Length); index += temp.Length - text.Length; } index = html.IndexOf(text, index + 1, StringComparison.CurrentCultureIgnoreCase); } doc.body.innerHTML = html; } public static string GetHtml(object document) { var doc = document as mshtml.IHTMLDocument2; if (doc == null || doc.body == null) return ""; return doc.body.innerHTML; } public static void SetHtml(object document, string html) { var doc = document as mshtml.IHTMLDocument2; if (doc == null || doc.body == null) return; doc.body.innerHTML = html; } } }