How to change RichHtmlEditor control settings in ListFormWebPart (on NewItem.aspx, EditItem.aspx pages)

We want to change the settings of Rich HTML Editor (RTE) controls inside NewItem.aspx and EditItem.aspx pages (disable the ability to allowing user to change the font styles). NewItem.aspx and EditItem.aspx are the pages you see when you want to add/edit item in SharePoint list library.

If RTE control is put directly on the page then we can easily set its properties by setting the attributes of the control element. (for example we can do something like this <SharePointPublishingWebControl:RichHtmlField id='rteControl' AllowFonts='False'/>.

But what can we do if RTE control is part of ListFormWebPart?

James Tsai Blog .NET C# SharePoint VSTO ListFormWebPart RichHtmlEditor Control 


1. Modify the .js files in 12hive. I would not recommend this approach, because changing OOTB files in 12hive could result unknown issues to the system.

2. My solution is to override the JavaScript functions used for RTE control rendering. We can put our new override functions inside NewItem.aspx/EditItem.aspx. And when page initializing RTE, it will use the override functions instead the OOTB ones.

To override functions, we can basically copy and paste the original functions from OOTB .js files to our pages. And change the functions implementation WITHOUT modify the signature of the functions.

RTE_ConvertTextAreaToRichEdit and RTE2_ResetAllToolBarStates are two most common functions you may have to change.

James Tsai Blog .NET C# SharePoint VSTO ListFormWebPart RichHtmlEditor Control

Above screen shot shows RTE settings has been changed by new JavaScript functions.

blog comments powered by Disqus