0

I have a fairly basic custom list in Sharepoint 2010 which contains a rich text field. I have customized the form with Infopath. Now when I export to Excel I find blank lines preceding the text.

After some testing, I have found that an extra blank line appears each time this field is edited. Eventually the text isn't even visible within excel as the field has grown so long that all of the real text is pushed off screen. These blank lines do not display anywhere within Sharepoint, only in Excel.

I have been able to duplicate this result in multiple different sharepoint 2010 environments, so it doesn't seem to be environmental in any way.

Does anyone know why this is happening and how I can fix it? Changing to plain text fixes the problem, but this is not ideal as the list should have rich text.

Edit:
Looking at the HTML of the field value on any of the Sharepoint screens shows that it is in fact nesting the value within another div with each save. After multiple saves the value looks something like this:

<div class="ExternalClass46C578CDD8CE4DDFB6D2482549C61A21">
    <div class="ExternalClass...">
        <div class="ExternalClass...">
            <div class="ExternalClass...">
                <div class="ExternalClass...">
                    <div class="ExternalClass...">
                        <div class="ExternalClass...">
                            <div class="ExternalClass...">

Edit2: It appears that the issue only occurs with Enhanced Rich Text and not regular Rich Text. However, changing from Enhanced to regular Rich Text does not fix existing records which already have the issue. It stops this from happening on new records and new edits but will not clear up the already deeply nested divs.

  • I had the same problem with Word, it's because rich text field creates invisible <div> tags around the content when you generate it in html, but in my case, I had no problems to use plain text instead. – Gintas K Oct 2 '13 at 11:56
0

I've come up with the following javascript (using jQuery) code which seems to work. I'd still definitely love to find a non-js solution, but this does seem to work.

$(document).delegate(".ms-rtestate-write", "blur", function(){
    // unwrap all but the first "ExternalClass" div
    $(this).find("div[class^='ExternalClass']").filter(":gt(0)").unwrap();
});

NOTE: I'm unfortunately stuck with jQuery 1.6.1. With any version 1.7 and beyond, you'd want to use on here in place of delegate. You probably also want to use something farther down the DOM than document for performance reasons, but I haven't identified a more suitable element yet.

I decided on the blur event because doing this on load is difficult due to the way infopath forms are loaded. It is also problematic that the form sometimes partially reloads. Using focus messed with the cursor position, so I settled on blur.

If I end up using this I will likely add it to the master page and target the given page. Adding it in a content editor through url-hack has some minor but annoying drawbacks.

0

I believe your seeing the result of a perfect storm from using InfoPath, Versioning and Enh Rich Text. http://www.guio.com/marlene/Lists/Posts/Post.aspx?ID=10.
Eliminate one of the three attributes(InfoPath, Versioning and Enh Rich Text) to resolve the issue .

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.