Why does SharePoint add the following to text entered into rich text fields of list items?

<div class="ExternalClass85AC900AB26A481DBDC8ADAE7A02F039"><p>....</p></div>

We've seen instances where we have two of these ExternalClass DIV tags wrapping content, even though we didn't add them. They cause the text to have weird, extra spacing on top and bottom, with the only solution for us being to go in and remove them from the HTML of the rich text field. We don't mind the P tags; but the unneeded DIVs are too much. And removing them doesn't affect the content in any way.

Anyone have a solution for this? Thanks.

  • Use JQuery to remove the div/remove spacing from the div? – Rawling Jan 30 '12 at 13:36
  • Thanks, Rawling. But that doesn't address the issue of why SP2010 adds the DIVs in the first place. – Alex C Jan 31 '12 at 6:13

Perhaps switching to alternate Rich Text Editor might be best option to get rid of these. At least RadEditor is one relatively common replacement. (I have no affiliation with RadEditor whatsoever).


This thread is quite old but there is a solution for it explained in this forum post: http://www.telerik.com/forums/table-formatting-lost-after-saving-a-list-item

Here are the two steps:
In order to workaround this issue you can create a custom content filter, which will strip .ExternalClassxxxxxxxxxxxxxxxxxxxxxxxxxxx class.

  1. Modify the respective ListConfigFile.xml, which is located in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/ folder.
    Add the following element:
<property name="OnClientLoad">OnClientLoad</property>
  1. Add the following JavaScript to the MOSSEditorTools.js, which is located in the mentioned above folder:
function OnClientLoad(editor, args)
    editor.get_filtersManager().add(new MyFilter());
MyFilter = function()
    this.set_name("RadEditor filter");
    this.set_description("RadEditor filter description");
MyFilter.prototype =
    getHtmlContent: function(content)
        var newContent = content;
        //Make changes to the content and return it
        newContent = newContent.replace(/\.ExternalClass[^ ]* /ig, "");
        return newContent;
MyFilter.registerClass('MyFilter', Telerik.Web.UI.Editor.Filter);
  • Please add a brief explanation of the steps outlined in the link you provided. If the link breaks at a later date, your answer will no longer be valuable. – Phil Greer Jul 11 '14 at 15:28
    public static string ListFieldTextMultileFilter(string val)
        var tmp30 = val;
        var tmp31 = XDocument.Parse(@"<tmp>" + tmp30 + @"</tmp>");
        XElement tmp32 = null;
        while (true)
            tmp32 = tmp31.Descendants().Where(it3 =>
               it3.Name.LocalName == @"div" &&
               it3.Attributes().Where(it5 =>
                   it5.Name == @"class" &&
                   it5.Value.StartsWith(@"External")).Count() > 0
            if (tmp32 == null) { break; }
        var ret = tmp31.FirstNode.ToString();
        ret = ret.Substring(@"<tmp>".Length, ret.Length - @"<tmp>".Length - @"</tmp>".Length);
        return ret;        
  • Thanks, @ivanivanov. Can you explain what the above method does and where it should be used? – Alex C Aug 3 '15 at 12:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.