SharePoint page layout with default html in RichHtmlField


Here is one of the scenarios I had come across, where in I had to create a custom page layout and a RichHtml field in it should have a pre-filled layout of html table with 2 columns.
You need to add your html to the Html attribute of the RichHtmlField control:

<PublishingWebControls:RichHtmlField
        AllowDragDrop="true"
        ID="AnnouncementBody"
        FieldName="FF268335-35E7-4306-B60F-E3666E5DDC08"
        Html="<table cellspacing='0' width='100%' class='ms-rteTable-default' style='height: 172px;'> <tbody> <tr> <td class='ms-rteTable-default' style='width: 25%;'>​​​ </td> <td class='ms-rteTable-default' style='width: 75%;'> </td> </tr> <tr> <td class='ms-rteTable-default' style='width: 25%;'>​</td> <td class='ms-rteTable-default' style='width: 75%;'>​</td> </tr> </tbody> </table> <br/>"
        runat="server">
       </PublishingWebControls:RichHtmlField>
Output:





Hope it helped you. Thank you :)

Comments

Popular posts from this blog

SharePoint Online (O365) OAuth Authentication | Authorizing REST API calls against SharePoint Online Site | Get Access token from SharePoint Online | Set up OAuth for SharePoint Online Office 365

SharePoint 2013 REST API Reference

Simple Risk Assessment Matrix table with resultant risk calculation

Kendo UI (Core JavaScript) grid Server Paging, Server Sorting and Server Filtering with Dynamic SQL queries

Sharepoint- Using an Image From formatmap32x32.png in a Ribbon Control