js清理Word格式示例代碼
更新時(shí)間:2014年02月13日 12:08:08 作者:
這篇文章主要介紹了使用JS清理Word格式的方法,需要的朋友可以參考下
復(fù)制代碼 代碼如下:
<input type="button" onclick="cleanWord();" value="Word清理" />
cleanWord = function(){
var editBody = FCKeditorAPI.GetInstance("text").EditorDocument.body;
var html = FCKeditorAPI.GetInstance("text").EditorDocument.body.innerText;
for(var intLoop=0;intLoop<editBody.all.length;intLoop++){
el=editBody.all[intLoop];
el.removeAttribute("className","",0);
el.removeAttribute("style","",0);
el.removeAttribute("font"," ",0);
}
html=html.replace(/<o:p> <\/o:p>/g,"");
html=html.replace(/o:/g,"");
html=html.replace(/<font>/g,"");
html=html.replace(/<FONT>/g,"");
html=html.replace(/<span>/g,"");
html=html.replace(/<SPAN>/g,"");
html=html.replace(/<SPANlang=EN-US>/g,"");
html=html.replace(/<P>/g,"");
html=html.replace(/<\/P>/g,"");
html=html.replace(/<\/SPAN>/g,"");
FCKeditorAPI.GetInstance("text").EditorDocument.body.innerText=html;
}
您可能感興趣的文章:
- 可以將word轉(zhuǎn)成html的js代碼
- js生成word中圖片處理方法
- JavaScript將Web頁面內(nèi)容導(dǎo)出到Word及Excel的方法
- javascript打開word文檔的方法
- javascript中直接引用Microsoft的COM生成Word
- JavaScript打開word文檔的實(shí)現(xiàn)代碼(c#)
- 幾個(gè)javascript操作word的參考代碼
- javascript 操作Word和Excel的實(shí)現(xiàn)代碼
- javascript下用ActiveXObject控件替換word書簽,將內(nèi)容導(dǎo)出到word后打印
- JS實(shí)現(xiàn)獲取word文檔內(nèi)容并輸出顯示到html頁面示例
相關(guān)文章
JavaScript數(shù)據(jù)庫TaffyDB用法實(shí)例分析
這篇文章主要介紹了JavaScript數(shù)據(jù)庫TaffyDB用法,實(shí)例分析了TaffyDB數(shù)據(jù)庫的定義、查詢、更新、刪除等操作的相關(guān)使用技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-07-07javascript實(shí)現(xiàn)unicode和字符的互相轉(zhuǎn)換
javascript實(shí)現(xiàn)unicode和字符的互相轉(zhuǎn)換...2007-07-07一步一步封裝自己的HtmlHelper組件BootstrapHelper(三)
一步一步封裝自己的HtmlHelper組件:BootstrapHelper,系列文章第三篇,感興趣的小伙伴們可以參考一下2016-09-09JavaScript實(shí)現(xiàn)文件的拖拽上傳功能
文件上傳,可以說是我們?cè)陧?xiàng)目中最常用的功能之一,文件上傳一般有兩種形式:點(diǎn)擊上傳和拖拽上傳,而上傳的內(nèi)容,又大體包括:文件和文件夾,本文給大家介紹了JavaScript實(shí)現(xiàn)文件的拖拽上傳功能的方法,需要的朋友可以參考下2024-02-02