Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 24, 2012 10:46 AM by Song-Tian - MSFT
Member
1 Points
4 Posts
May 23, 2012 08:41 PM|LINK
Hi
I am new at using the ajax editor. I need a method where user can paste into a text field from MS Word or other applications.
I need to be able to remove the HTML tags from the text.
I have tried the paste from MS Word with Cleanup but nothing is happening. Do I need to write my own code behind this button ?
If there is another way of doing it I would be happy to try that.
Thanks.
All-Star
66639 Points
11275 Posts
May 24, 2012 03:25 AM|LINK
Refer this thread
http://forums.asp.net/t/1492114.aspx
http://forums.asp.net/p/1554241/3827204.aspx
http://forums.asp.net/t/1611877.aspx/1?HTMLeditor+always+paste+with+word+clean+up+on+
43715 Points
4304 Posts
Microsoft
May 24, 2012 10:46 AM|LINK
Hi,
I think you may need regular expression to do that.
For example:
static string SanitizeHtml(string html) { string acceptable = "script|link|title"; string stringPattern = @"</?(?(?=" + acceptable + @")notag|[a-zA-Z0-9]+)(?:\s[a-zA-Z0-9\-]+=?(?:(["",']?).*?\1?)?)*\s*/?>"; return Regex.Replace(html, stringPattern, "sausage"); }
mjb99
Member
1 Points
4 Posts
Ajax HTMLEditor Paste how do i remove HTML
May 23, 2012 08:41 PM|LINK
Hi
I am new at using the ajax editor. I need a method where user can paste into a text field from MS Word or other applications.
I need to be able to remove the HTML tags from the text.
I have tried the paste from MS Word with Cleanup but nothing is happening. Do I need to write my own code behind this button ?
If there is another way of doing it I would be happy to try that.
Thanks.
chetan.sarod...
All-Star
66639 Points
11275 Posts
Re: Ajax HTMLEditor Paste how do i remove HTML
May 24, 2012 03:25 AM|LINK
Refer this thread
http://forums.asp.net/t/1492114.aspx
http://forums.asp.net/p/1554241/3827204.aspx
http://forums.asp.net/t/1611877.aspx/1?HTMLeditor+always+paste+with+word+clean+up+on+
Senior Software Engineer,
Approva Systems Pvt Ltd, Pune, India.
Song-Tian - ...
All-Star
43715 Points
4304 Posts
Microsoft
Re: Ajax HTMLEditor Paste how do i remove HTML
May 24, 2012 10:46 AM|LINK
Hi,
I think you may need regular expression to do that.
For example:
static string SanitizeHtml(string html) { string acceptable = "script|link|title"; string stringPattern = @"</?(?(?=" + acceptable + @")notag|[a-zA-Z0-9]+)(?:\s[a-zA-Z0-9\-]+=?(?:(["",']?).*?\1?)?)*\s*/?>"; return Regex.Replace(html, stringPattern, "sausage"); }Feedback to us
Develop and promote your apps in Windows Store