title: Cannot insert the OpenXmlElement "newChild" because it is part of a tree
body: <p>The Title states the error I am getting. I'm trying to <strong>hide</strong> all the text in a word doc using OpenXml. Currently when I try and append the Paragraph properties I receive the above error. I can't find much about this error online.</p>
  
  <p>Code that returns error </p>
  
  <pre><code>        using (WordprocessingDocument wdDoc = WordprocessingDocument.Open(mDoc_copy, true))
          {
              // Manage namespaces to perform XPath queries.
              NameTable nt = new NameTable();
              XmlNamespaceManager nsManager = new XmlNamespaceManager(nt);
              nsManager.AddNamespace("w", wordmlNamespace);
  
              // Get the document part from the package.
              // Load the XML in the document part into an XmlDocument instance.
              XmlDocument xdoc = new XmlDocument(nt);
              xdoc.Load(wdDoc.MainDocumentPart.GetStream());
  
              MainDocumentPart main = wdDoc.MainDocumentPart;
  
              IEnumerable&lt;OpenXmlElement&gt; elem = main.Document.Body.Descendants().ToList();
              Paragraph p;
              ParagraphProperties pp = new ParagraphProperties();
              ParagraphMarkRunProperties prmp = new ParagraphMarkRunProperties();
              Vanish v = new Vanish();
              apprmp.AppendChild&lt;Vanish&gt;(v);
              pp.AppendChild&lt;ParagraphMarkRunProperties&gt;(apprmp);
  
  
              foreach (Paragraph para in main.Document.Body.Descendants&lt;Paragraph&gt;().ToList())
              {
  
  
                      para.ParagraphProperties = pp;
  
              }
         }
  </code></pre>