Embed Content Editor Web Part inside a Web Part Zone…

Once I had a requirement to embed a Content Editor Web Part, with some default content, to a web part page. So I followed the usual steps to extract my web part.

1) Add a CEWP to a Web Part zone in my SharePoint web site.

2) Add the default content that was needed, and format it appropriately.

3) Export the web part as a file.

4) Copy the content of the file and place inside a AllUserWebPartZone.

<AllUsersWebPart WebPartZoneID=”Left” WebPartOrder=”1″ Width=”100%”>


<WebPart ………

At the step 4 I got an issue. That was the   <Content> element in the content editor web part it self had a CDATA section. So the document was not valid.

<AllUsersWebPart WebPartZoneID=”Left” WebPartOrder=”1″ Width=”100%”>


<WebPart ………


<Content xmlns=”http://schemas.microsoft.com/WebPart/v2/ContentEditor“>

<![CDATA[ <h1>My Heading</h1><p> My contnet</p> ]]></Content>





So the solution was to replace the internal CDATA section (wrapping the CEWP text content) with some other format. So I copied the content section and used a online HTML encoder (just search for it and you will find plenty of good encoders) to encode the content. Then replaced the CDATA section with the encoded content. That worked like a charm Smile

<Content xmlns=”http://schemas.microsoft.com/WebPart/v2/ContentEditor“>

&lt;P&gt;&lt;STRONG&gt;&lt;FONT face=Arial size=3&gt;Welcome to Project Centre&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Project Centre is the central point for planning, tracking and col……


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s