加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 教程 > 正文

去除word粘多html代的ClearWord函

发布时间:2023-05-08 13:40:08 所属栏目:教程 来源:
导读:我在利用FckEditor器的候有一清除Word粘的多html代的功能,它是利用javascript的。有了功能以後,我的容可以直接Word拷粘而不用心容有一大堆多的西料空影行的性能了。

那,我照了Fckeditor的javascript功能了CFS
我在利用FckEditor器的候有一清除Word粘的多html代的功能,它是利用javascript的。有了功能以後,我的容可以直接Word拷粘而不用心容有一大堆多的西料空影行的性能了。
 
那,我照了Fckeditor的javascript功能了CFScript功能版本的ClearWord函,利用函在面容添加入可以直接行清除冗操作了。
 
<!---
 
/***********************************************************
 
* 面功能         : 清除word粘多html代
 
* 作者                : 子心(方恩)
 
* 版本                : 1.0
 
* 建         : 2005-11-29
 
* 作者主         : http://www.cfcodes.com
 
* 箱         : chinavane@msn.com
 
* Msn          : chinavane@msn.com
 
* Oicq         : 13525442
 
* 史版本         :
 
 *                 :[html] 有Word冗代的html容
 
***********************************************************/
 
--->
 
<cfscript>
 
    function CleanWord(html)
 
    {
 
        html = REReplaceNocase(html,'<o:p>s*</o:p>','','all');
 
        html = REReplaceNocase(html,'<o:p>.*?</o:p>',' ','all');
 
        html = REReplaceNocase(html,'s*mso-[^:]+:[^;"]+;?','','all');
 
        html = REReplaceNocase(html,'s*MARGIN: 0cm 0cm 0pts*;','','all');
 
        html = REReplaceNocase(html,'s*MARGIN: 0cm 0cm 0pts*"','""','all');
 
        html = REReplaceNocase(html,'s*TEXT-INDENT: 0cms*;','','all');
 
        html = REReplaceNocase(html,'s*TEXT-INDENT: 0cms*"','""','all');
 
        html = REReplaceNocase(html,'s*TEXT-ALIGN: [^s;]+;?"','""','all');
 
        html = REReplaceNocase(html,'s*PAGE-BREAK-BEFORE: [^s;]+;?"','""','all');
 
        html = REReplaceNocase(html,'s*FONT-VARIANT: [^s;]+;?"','""','all');
 
        html = REReplaceNocase(html,'s*tab-stops:[^;"]*;?','','all');
 
        html = REReplaceNocase(html,'s*tab-stops:[^"]*','','all');
 
        html = REReplaceNocase(html,'s*face="[^"]*"','','all');
 
        html = REReplaceNocase(html,'s*face=[^ >]*','','all');
 
        html = REReplaceNocase(html,'s*FONT-FAMILY:[^;"]*;?','','all');
 
        html = REReplaceNocase(html,'<(w[^>]*) class=([^ |>]*)([^>]*)','<1','all');
 
        html = REReplaceNocase(html,'<(w[^>]*) style="([^""]*)"([^>]*)','<1','all');
 
        html = REReplaceNocase(html,'s*style="s*"','','all');
 
        html = REReplaceNocase(html,'<SPANs*[^>]*>s* s*</SPAN>',' ','all');
 
        html = REReplaceNocase(html,'<SPANs*[^>]*></SPAN>','','all');
 
        html = REReplaceNocase(html,'<(w[^>]*) lang=([^ |>]*)([^>]*)','<1','all');
 
        html = REReplaceNocase(html,'<SPANs*>(.*?)</SPAN>','1','all');
 
        html = REReplaceNocase(html,'<FONTs*>(.*?)</FONT>','1','all');
 
        html = REReplaceNocase(html,'</??xml[^>]*>','','all');
 
        html = REReplaceNocase(html,'</?w+:[^>]*>','','all');
 
        html = REReplaceNocase(html,'<Hd>s*</Hd>','','all');   
 
        html = REReplaceNocase(html,'<H1([^>]*)>','<div1><b><font size="6">','all');
 
        html = REReplaceNocase(html,'<H2([^>]*)>','<div1><b><font size="5">','all');
 
        html = REReplaceNocase(html,'<H3([^>]*)>','<div1><b><font size="4">','all');
 
        html = REReplaceNocase(html,'<H4([^>]*)>','<div1><b><font size="3">','all');
 
        html = REReplaceNocase(html,'<H5([^>]*)>','<div1><b><font size="2">','all');
 
        html = REReplaceNocase(html,'<H6([^>]*)>','<div1><b><font size="1">','all');            
 
        html = REReplaceNocase(html,'</Hd>','</font></b></div>','all');
 
        html = REReplaceNocase(html,'<(U|I|STRIKE)> </1>',' ','all');
 
        html = REReplaceNocase(html,'<([^s>]+)[^>]*>s*</1>','','all');
 
        html = REReplaceNocase(html,'<([^s>]+)[^>]*>s*</1>','','all');
 
        html = REReplaceNocase(html,'<([^s>]+)[^>]*>s*</1>','','all');
 
        html = REReplaceNocase(html,'(<P)([^>]*>.*?)(</P>)','<div2</div>','all');
 
        return html;
 
    }
 
</cfscript>
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!