Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SautinSoft.HtmlToRtf h = new SautinSoft.HtmlToRtf();
- h.OutputFormat = HtmlToRtf.eOutputFormat.TextUnicode;
- string text = h.ConvertString(htmlString);
- public static string StripHTML(string HTMLText)
- {
- Regex reg = new Regex("<[^>]+>", RegexOptions.IgnoreCase);
- return reg.Replace(HTMLText, "");
- }
- IHTMLDocument2 htmlDoc = (IHTMLDocument2)webBrowser.Document;
- string innerHTML = htmlDoc.body.innerHTML;
- string innerText = htmlDoc.body.innerText;
- public static string ToMarkDown(this string input)
- {
- var process = new Process();
- process.StartInfo = new ProcessStartInfo("python", "tools/html2text.py")
- {
- RedirectStandardInput = true,
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = true,
- };
- process.Start();
- process.StandardInput.Write(input);
- process.StandardInput.Close();
- string md = process.StandardOutput.ReadToEnd();
- process.WaitForExit();
- process.Dispose();
- return md;
- }
- using System;
- using System.Text.RegularExpressions;
- public static class StringHelpers
- {
- public static string StripHTML(this string HTMLText)
- {
- var reg = new Regex("<[^>]+>", RegexOptions.IgnoreCase);
- return reg.Replace(HTMLText, "");
- }
- }
- var yourHtmlString = "<div class="someclass"><h2>yourHtmlText</h2></span>";
- var yourTextString = yourHtmlString.StripHTML();
Add Comment
Please, Sign In to add comment