Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Recently I was looking for similar thing after bit of googling I found a nice function. It has most of the <strong>bad</strong> tags listed. here is the link which contains that function: </p> <p>Javascript Function</p> <pre><code>&lt;script type="text/javascript" runat="server" language="javascript"&gt; function CleanWordHTML( str ) { str = str.replace(/&lt;o:p&gt;\s*&lt;\/o:p&gt;/g, "") ; str = str.replace(/&lt;o:p&gt;.*?&lt;\/o:p&gt;/g, "&amp;nbsp;") ; str = str.replace( /\s*mso-[^:]+:[^;"]+;?/gi, "" ) ; str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, "" ) ; str = str.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ; str = str.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, "" ) ; str = str.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ; str = str.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ; str = str.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ; str = str.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ; str = str.replace( /\s*tab-stops:[^;"]*;?/gi, "" ) ; str = str.replace( /\s*tab-stops:[^"]*/gi, "" ) ; str = str.replace( /\s*face="[^"]*"/gi, "" ) ; str = str.replace( /\s*face=[^ &gt;]*/gi, "" ) ; str = str.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, "" ) ; str = str.replace(/&lt;(\w[^&gt;]*) class=([^ |&gt;]*)([^&gt;]*)/gi, "&lt;$1$3") ; str = str.replace( /&lt;(\w[^&gt;]*) style="([^\"]*)"([^&gt;]*)/gi, "&lt;$1$3" ) ; str = str.replace( /\s*style="\s*"/gi, '' ) ; str = str.replace( /&lt;SPAN\s*[^&gt;]*&gt;\s*&amp;nbsp;\s*&lt;\/SPAN&gt;/gi, '&amp;nbsp;' ) ; str = str.replace( /&lt;SPAN\s*[^&gt;]*&gt;&lt;\/SPAN&gt;/gi, '' ) ; str = str.replace(/&lt;(\w[^&gt;]*) lang=([^ |&gt;]*)([^&gt;]*)/gi, "&lt;$1$3") ; str = str.replace( /&lt;SPAN\s*&gt;(.*?)&lt;\/SPAN&gt;/gi, '$1' ) ; str = str.replace( /&lt;FONT\s*&gt;(.*?)&lt;\/FONT&gt;/gi, '$1' ) ; str = str.replace(/&lt;\\?\?xml[^&gt;]*&gt;/gi, "") ; str = str.replace(/&lt;\/?\w+:[^&gt;]*&gt;/gi, "") ; str = str.replace( /&lt;H\d&gt;\s*&lt;\/H\d&gt;/gi, '' ) ; str = str.replace( /&lt;H1([^&gt;]*)&gt;/gi, '' ) ; str = str.replace( /&lt;H2([^&gt;]*)&gt;/gi, '' ) ; str = str.replace( /&lt;H3([^&gt;]*)&gt;/gi, '' ) ; str = str.replace( /&lt;H4([^&gt;]*)&gt;/gi, '' ) ; str = str.replace( /&lt;H5([^&gt;]*)&gt;/gi, '' ) ; str = str.replace( /&lt;H6([^&gt;]*)&gt;/gi, '' ) ; str = str.replace( /&lt;\/H\d&gt;/gi, '&lt;br&gt;' ) ; //remove this to take out breaks where Heading tags were str = str.replace( /&lt;(U|I|STRIKE)&gt;&amp;nbsp;&lt;\/\1&gt;/g, '&amp;nbsp;' ) ; str = str.replace( /&lt;(B|b)&gt;&amp;nbsp;&lt;\/\b|B&gt;/g, '' ) ; str = str.replace( /&lt;([^\s&gt;]+)[^&gt;]*&gt;\s*&lt;\/\1&gt;/g, '' ) ; str = str.replace( /&lt;([^\s&gt;]+)[^&gt;]*&gt;\s*&lt;\/\1&gt;/g, '' ) ; str = str.replace( /&lt;([^\s&gt;]+)[^&gt;]*&gt;\s*&lt;\/\1&gt;/g, '' ) ; //some RegEx code for the picky browsers var re = new RegExp("(&lt;P)([^&gt;]*&gt;.*?)(&lt;\/P&gt;)","gi") ; str = str.replace( re, "&lt;div$2&lt;/div&gt;" ) ; var re2 = new RegExp("(&lt;font|&lt;FONT)([^*&gt;]*&gt;.*?)(&lt;\/FONT&gt;|&lt;\/font&gt;)","gi") ; str = str.replace( re2, "&lt;div$2&lt;/div&gt;") ; str = str.replace( /size|SIZE = ([\d]{1})/g, '' ) ; return str ; } &lt;/script&gt; </code></pre> <p><a href="http://www.1stclassmedia.co.uk/developers/clean-ms-word-formatting.php" rel="nofollow noreferrer">http://www.1stclassmedia.co.uk/developers/clean-ms-word-formatting.php</a></p> <p>all credits to original author.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload