1

Topic: why strip style tags?

The code below is stipping style from a excel worksheet i am pasting in. Thus all the colors go away. I commented out the following line
//el.removeAttribute("style","",0);
Anyone had this problem? It looks like its related to microsoft documents because its looking for 'mso' in the html. Anyone know the implications of changing this? Anyone know the bug# this is associated with? Commenting this out fixes THAT problem, just wondering if it is creates others.
Thanks!


        // Content duplication bug fix (Seems to be word crap)
        var html = doc.body.innerHTML;
        if (html.indexOf('="mso') != -1) {
            for (var i=0; i<doc.body.all.length; i++) {
                var el = doc.body.all[i];
                el.removeAttribute("className","",0);
                //el.removeAttribute("style","",0);
            }

            html = doc.body.innerHTML;
            html = tinyMCE.regexpReplace(html, "<o:p><\/o:p>", "<br />");
            html = tinyMCE.regexpReplace(html, "<o:p> <\/o:p>", "");
            html = tinyMCE.regexpReplace(html, "<st1:.*?>", "");
            html = tinyMCE.regexpReplace(html, "<p><\/p>", "");
            html = tinyMCE.regexpReplace(html, "<p><\/p>\r\n<p><\/p>", "");
            html = tinyMCE.regexpReplace(html, "<p> <\/p>", "<br />");
            html = tinyMCE.regexpReplace(html, "<p>\s*(<p>\s*)?", "<p>");
            html = tinyMCE.regexpReplace(html, "<\/p>\s*(<\/p>\s*)?", "</p>");
        }
        // Always set the htmlText output
        tinyMCE.setInnerHTML(doc.body, html);

2

Re: why strip style tags?

oops forgot, this is in the tiny_mce.js file (or the source.js).

3

Re: why strip style tags?

Have you had problems with this?  Wanted to see how the code change is going for you? 

I'm having similar problems. Our users have word documents that are formatted, and they use the paste from Word option and most of the formatting is completely gone. THis only happens on certain documents where they have custom styles.

Any response is appreciated.

-Mukesh