Search code examples
asp.nettagsoffice-2007

Remove Word 2007 tags from a text


Is there a way to remove tags from text, that was copy-pasted from Word 2007 on a server side (.NET) or client one (javascript). I need just text, without any formatting.


Solution

  • I would suggest removing all tags on the server site, so no one with deactivated JavaScript sees them:

    using System.Text.RegularExpressions;
    string word2007 = "<h3>word2007</h3><p>test</p>";
    Regex.Replace(word2007 ,"<[^>]*>",string.Empty)