Quantcast
Channel: Open XML Format SDK forum
Viewing all articles
Browse latest Browse all 1288

Word Open XML - Adding a new element

$
0
0

I have a content control like this

SdtBlock xSdtBlock = (SdtBlock)contentcontrol;
SdtProperties sdrprops = xSdtBlock.Descendants<SdtProperties>().FirstOrDefault();

How do I add an element inside of that? The element I want to add is 

     <w15:appearance w15:val="hidden"/>

so that the xml block looks like

    <w:sdtPr>
     <w:rPr>
      <w:lang w:val="en-GB"/>
     </w:rPr>
     <w:alias w:val="TitleTest"/>
     <w:tag w:val="TagTest"/>
     <w:id w:val="1500618722"/>
     <w:temporary/>
     <w:showingPlcHdr/>
     <w15:appearance w15:val="hidden"/>
     <w:picture/>
    </w:sdtPr>

instead of current

      

    <w:sdtPr>
     <w:rPr>
      <w:lang w:val="en-GB"/>
     </w:rPr>
     <w:alias w:val="TitleTest"/>
     <w:tag w:val="TagiTest"/>
     <w:id w:val="1500618722"/>
     <w:temporary/>
     <w:showingPlcHdr/>
     <w:picture/>
    </w:sdtPr>

I'm trying to accomplish the same that what can be done in Word by setting content control properties "Show as" to "None" instead of "Bounding Box" so that the placeholder image wouldn't be displayed anymore.


Viewing all articles
Browse latest Browse all 1288

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>