Domanda

I am creating a word document with plain text content controls.

I have added a few of these and got code working that substitutes value from an XML file into the content controls. However now when i add a content control to the template I can see whats like a play sign before and after the tag text when in design mode( <| and |> ). Can someone explain what these are and how to get rid of them as they are causing my code to crash. This line returns null when the symbols are on the content control tags

XElement run = element.Element(w + "sdtContent").Element(w + "r");

It returns a value for all the other tags.

È stato utile?

Soluzione

This sign appears when sdtContent contains a Paragraph as displayed below

<w:sdt>
  <w:sdtPr>        
    <w:id w:val="397949701"/>
    <w:placeholder>
      <w:docPart w:val="6FCFBA48E30F4D3797F7E20820FF13DE"/>
    </w:placeholder>
    <w:showingPlcHdr/>
    <w:text/>
  </w:sdtPr>
  <w:sdtEndPr/>
  <w:sdtContent>
    <w:p w:rsidR="008D0325" w:rsidRPr="008D0325" w:rsidRDefault="008D0325" w:rsidP="008D0325">
      <w:pPr>
        <w:rPr>
          <w:b/>
        </w:rPr>
      </w:pPr>
      <w:r w:rsidR="00060F2E" w:rsidRPr="004E36F4">
        <w:t>Click here to enter text.</w:t>
      </w:r>
    </w:p>
  </w:sdtContent>
</w:sdt>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top