How can get plain text from Ajax editor
When i use the following mathod i m getting
public static class StringHelpers
{
public static string StripHTML(this string HTMLCode)
{
HTMLCode = HTMLCode.Replace("\n", " ");
HTMLCode = HTMLCode.Replace("\t", " ");
HTMLCode = Regex.Replace(HTMLCode, "\\s+", " ");
HTMLCode = Regex.Replace(HTMLCode, "<head.*?", ""
, RegexOptions.IgnoreCase | RegexOptions.Singleline);
HTMLCode = Regex.Replace(HTMLCode, "<script.*?", ""
, RegexOptions.IgnoreCase | RegexOptions.Singleline);
System.Text.StringBuilder sbHTML = new System.Text.StringBuilder(HTMLCode);
string[] OldWords = {" ", "&", """, "<",
">", "®", "©", "•", "™"};
string[] NewWords = { " ", "&", "\"", "<", ">", "®", "©", "•", "™" };
for (int i = 0; i < OldWords.Length; i++)
{
sbHTML.Replace(OldWords[i], NewWords[i]);
}
sbHTML.Replace("<br>", "\n<br>");
sbHTML.Replace("<br hold=" /> sbHTML.Replace("><p hold=" /><br mode="><[^>]*>", "");
return System.Text.RegularExpressions.Regex.Replace(
sbHTML.ToString(), "<[^>]*>", "");
}
}
the out put become
(IT TAKE ALONG WITH EDITOR INFORMATION IN START AND LATER PROPER TEXT INFORMATION)
as
(first in comes)
Normal 0 false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable{mso-style-name:"Table Normal";mso-tstyle-rowband-size:0;mso-tstyle-colband-size:0;mso-style-noshow:yes;mso-style-priority:99;mso-style-parent:"";mso-padding-alt:0in 5.4pt 0in 5.4pt;mso-para-margin-top:0in;mso-para-margin-right:0in;mso-para-margin-bottom:10.0pt;mso-para-margin-left:0in;line-height:115%;mso-pagination:widow-orphan;font-size:11.0pt;font-family:"Calibri","sans-serif";mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman";mso-bidi-theme-font:minor-bidi;}
(Text start from here)
The MirasInternational School, Astana (is the member of the NursultanNazarbayev Educational Foundation) was formally opened on September 2,1999 as a private educational institution offering a curriculumbased on the Kazakh National Curriculum and the InternationalBaccalaureate (IB) Programmes.In 2004 we made a great achievement, becoming the only theschool in Kazakhstan accredited by the New England Associationof the Schools and Colleges (NEASC),the Council of International Schools (CIS) and authorized by the International Baccalaureatefor three IB Programmes (PYP, MYP and DP). The Schoolprovides a holistic, stimulating, balanced and challenging education. Theprograms follow three stages: Kindergarten to Grade 5; Grades 6–10, Grade11.
[edit]Code block added - OriginalGriff[/edit]