1

We paste a lot of information into our multi line SharePoint 2010 list fields from other sources. We want to be able to bring in items like bullets and tables but want to enforce a universal font and font size. It wouldn't make sense to originally author the content in SharePoint or remove all of the formatting as we would lose items such as tables. What ways can we enforce standards or change content dynamically to a set of font and font-size standards? For instance we may want to use font size 12 and Times New Roman used in all of these list fields. Perhaps one way would be for a script to run upon submission of the form that changes the pasted font.

Thanks.

1

You can use the PreSaveAction function on your form to run JavaScript code when the form is submitted.

Here is a function that will change the text in all Rich-Text-Editors to black, Times New Roman, 12px.

function PreSaveAction(){
    jQuery(".ms-rtestate-write *").each(function(){
        jQuery(this).css({
            "color":        "#000000", 
            "font-family":  "Times New Roman", 
            "font-size":    "12px"
        })
    })
    return true;
}

You could put that code into a Script Editor or Content Editor Webpart. Once you submit your form the code will run and change the attributes acccordingly.

| improve this answer | |
0

Either that or using server side code and creating an event handler for ItemAdded and ItemUpdated.

Other option is changing the corresponding css file for Rich Text Field, as discussed here Change default font of rich text editor

Relevant file and section:

<SharePoint:CssRegistration name="/Style Library/en-us/Custom/custom.css" After="corev4.css" runat="server"/>

.ms-rtestate-write {
    color: black;
    cursor: text;
    font-family: arial;
    font-size: 12pt;
    min-height: 1em;
}
| improve this answer | |

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.