My Account   Contact Us    
  
» HomeProductsSupportDeveloper CommunityCompany
Strip font tags for Word content

A simple method to remove inline styles converted from font tags in Word content


When content is pasted from Word into ActivEdit with the paste button in version 3.0 or later, font tags are converted to inline styles.

Although many users prefer this behavior, it can be a nuissance when using CSS, since inline styles take precedence over styles applied from a stylesheet.

You can change this behavior by overriding ae_onPaste() through the API and removing the call to replaceFontsWithSpans() by adding the following API function to your form page.

<script>
    function aeapi_local_onLoad(aeObject, fieldname) {
        ae_onPaste = function(num) {
            DHTMLSafe=aeObjects[num];
            window.event.returnValue = true;
            var tr = DHTMLSafe.DOM.selection.createRange();
            tr.execCommand("Paste");
            //replaceFontsWithSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
            condenseSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
            ae_cleanWord(DHTMLSafe); 
        }
    }
</script>

You can further modify the parser by adding additional function callbacks to ae_onPaste() or overriding ae_cleanWord(). You should do this through the API, rather than editing the functions in the library to maintain portability to future updates and upgrades and to allow for multiple behaviors. You'll need the source for reference to existing function body content.

Search Knowledge Base:
Sign up for our newsletter: | Subscribe with RSS: RSS
© ActivSoftware 1999 to 2005 | Privacy Statement