清除WORD冗余格式并粘贴
2004-10-03 15:40
211 查看
/ 清除WORD冗余格式并粘贴
function cleanAndPaste( html ) {
// Remove all SPAN tags
html = html.replace(/<//?SPAN[^>]*>/gi, "" );
// Remove Class attributes
html = html.replace(/<(/w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove Style attributes
html = html.replace(/<(/w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
// Remove Lang attributes
html = html.replace(/<(/w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove XML elements and declarations
html = html.replace(/<*>/gi]//?/?xml[^>]*>/gi, "") ;
// Remove Tags with XML namespace declarations: <o:p></o:p>
html = html.replace(/<//?/w+:[^>]*>/gi, "") ;
// Replace the
html = html.replace(/ /, " " );
// Transform <P> to <DIV>
var re = new RegExp("(<P)([^>]*>.*?)(<//P>)","gi") ; // Different because of a IE 5.0 error
html = html.replace( re, "<div$2</div>" ) ;
insertHTML( html ) ;
}
function cleanAndPaste( html ) {
// Remove all SPAN tags
html = html.replace(/<//?SPAN[^>]*>/gi, "" );
// Remove Class attributes
html = html.replace(/<(/w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove Style attributes
html = html.replace(/<(/w[^>]*) style="([^"]*)"([^>]*)/gi, "<$1$3") ;
// Remove Lang attributes
html = html.replace(/<(/w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ;
// Remove XML elements and declarations
html = html.replace(/<*>/gi]//?/?xml[^>]*>/gi, "") ;
// Remove Tags with XML namespace declarations: <o:p></o:p>
html = html.replace(/<//?/w+:[^>]*>/gi, "") ;
// Replace the
html = html.replace(/ /, " " );
// Transform <P> to <DIV>
var re = new RegExp("(<P)([^>]*>.*?)(<//P>)","gi") ; // Different because of a IE 5.0 error
html = html.replace( re, "<div$2</div>" ) ;
insertHTML( html ) ;
}
相关文章推荐
- 清除WORD冗余格式并粘贴
- 清除Fckeditor2.6.3 粘贴Word格式 弹出提示,并把word格式清除掉
- FckEditor中从word文档粘贴过来的内容在点击确定清除格式后直接清除而不是再弹出从MS WORD粘贴对话框的实现
- FckEditor中从word文档粘贴过来的内容在点击确定清除格式后直接清除而不是再弹出从MS WORD粘贴对话框
- 如何清除从网页中粘贴到word中的格式
- FckEditor中从word文档粘贴过来的内容在点击确定清除格式后直接清除而不是再弹出从MS WORD粘贴对话框
- FreeTextBox中清除word格式
- word 中无格式粘贴的设置方法(快捷键和按钮)
- 清理Word生成HTML的冗余;清理与清除HTML标签
- Word 录制宏解决粘贴网络上文字格式错乱
- word 中无格式粘贴的设置方法(快捷键和按钮)
- PHP怎么样去掉从word直接粘贴过来的没有用的格式
- kindeditor粘贴word文档内容时去除格式的方法?如何设置为默认无文本格式呢?
- 清理Word生成HTML的冗余;清理与清除HTML标签1
- word 无格式粘贴
- tinymce中粘贴word文本时保留格式
- 去掉word冗余格式 java正则表达式
- 清除Word页眉横线且不影响页眉格式的方法
- 清除WORD格式HTML垃圾样式
- 如何快速清除word(或网页)复制过来的文字背景色及格式