title: Insert an XML string into an openXML document
body: <p>I'm trying to replace a text element placeholder with an image in an openXML docx.</p>
  
  <p>I've found a tutorial <a href="http://www.codewrecks.com/blog/index.php/2008/09/02/openxml-format-insert-an-image-into-a-document/" rel="nofollow">here</a> which seems to do what I need, but I'm not quite following what he does to insert the image.</p>
  
  <p>Basically, I have an XML 'image template' stored in a string. I can store my image to media folder and insert the image ID into the XML string:</p>
  
  <pre><code>string imageNode 
           = _xml.Replace("##imageId##", documentMainPart.GetIdOfPart(newImage));
  </code></pre>
  
  <p>so now I have the correct XML as a string which I need to insert into the document.</p>
  
  <p>I can find my placeholder text node which I want to replace with the new image XML</p>
  
  <pre><code>var placeholder = documentMainPart.Document.Body
                 .Descendants&lt;DocumentFormat.OpenXml.Wordprocessing.Text&gt;()
                 .Where(t =&gt; t.Text.Contains("##imagePlaceholder##")).First();
  </code></pre>
  
  <p>But this is where I get stuck. I can't see how to do a replace/insert which will take an XML string. I've managed to get my XML output as text in the document, but I beed to somehow convert it into an XML element.</p>