Hi Wajid,
I have used this document.xml containing <w:temporary /> to mark content control
to remove content control when edited. And it exact does what is suppose to do.
I am loading document.xml file into main document
using (WordprocessingDocument wordDoc =
WordprocessingDocument.Open(@"C:\test\aa.docx", true))
{
MainDocumentPart mainPart = wordDoc.MainDocumentPart;
XmlDocument mainDoc = new XmlDocument();
mainDoc.Load(@"..\..\MainpartXML.xml"); // this document.xml file
containing <w:temporary />
mainDoc.Save(mainPart.GetStream());
// your code goes here
When the document is ready with the custom xml, content control with a place
holder appear.
Select the content control, select Developer ribbbon and click on properties in
the controls box."remove content controls when controls are edited" is checked.
So, <w:temporary /> element is doing its job.
This is my document.xml file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
<w:body>
<w:p w:rsidR="000F3ACF" w:rsidRDefault="000F3ACF"
w:rsidP="000F3ACF">
<w:r>
<w:t>The customer name is:</w:t>
</w:r>
<w:r>
<w:tab/>
</w:r>
<w:sdt>
<w:sdtPr>
<w:id w:val="865823534"/>
<w:placeholder>
<w:docPart
w:val="DefaultPlaceholder_22675703"/>
</w:placeholder>
<w:showingPlcHdr/>
<w:dataBinding
w:prefixMappings="xmlns:ns0='http://myschemas/thisone'"
w:xpath="/ns0:Customer[1]/ns0:Name" w:storeItemID="myCustomXmlDataIdentifier"/>
<w:alias w:val="SampleTile" />
<w:tag w:val="SampleTag" />
<w:text/>
<w:temporary />
</w:sdtPr>
<w:sdtContent>
<w:r w:rsidRPr="00B90F6A">
<w:rPr>
<w:rStyle
w:val="PlaceholderText"/>
</w:rPr>
<w:t>Click here to enter
text.</w:t>
</w:r>
</w:sdtContent>
</w:sdt>
<w:r w:rsidRPr="000F3ACF">
<w:t xml:space="preserve"> </w:t>
</w:r>
</w:p>
<w:p w:rsidR="000F3ACF" w:rsidRPr="000F3ACF"
w:rsidRDefault="000F3ACF" w:rsidP="000F3ACF"/>
<w:sectPr w:rsidR="000F3ACF" w:rsidRPr="000F3ACF"
w:rsidSect="000F371E">
<w:pgSz w:w="12240" w:h="15840"/>
<w:pgMar w:top="1440" w:right="1800" w:bottom="1440"
w:left="1800" w:header="720" w:footer="720" w:gutter="0"/>
<w:cols w:space="720"/>
<w:docGrid w:linePitch="360"/>
</w:sectPr>
</w:body>
</w:document>
Sheela