To set the content of a Content Editor Web Part (CEWP) by code you need to set the Content property of the ContentEditorWebPart class. There is an example of how to do this in the aforementioned MSDN link.
There is however a small trick required if you want to set the content to HTML, e.g. <b>Hello world!</b>.
The trick is to wrap the content of the XML node in a CDATA section. Below is the modified example from MSDN to do this:
// Create a new Content Editor Web Part. ContentEditorWebPart ceWebPart = new ContentEditorWebPart(); // Create an XmlElement to hold the value of the Content property. XmlDocument xmlDoc = new XmlDocument(); XmlElement xmlElement = xmlDoc.CreateElement("MyElement"); // Wrap content in CDATA section if it contains HTML xmlElement.InnerText = "<![CDATA[<b>Hello world!</b>]]>"; // Set the Content property to the XmlElement. ceWebPart.Content = xmlElement;