How to add smart tags/key-value pair in document.xml for content control RRS feed

  • Question


    Hi all,

    I wanted to distinguish each content control separately in document.xml and process them as per unique id (id given by my application). For this, I need to add key-value pair on the content control in document.xml, this key-value should not be visible to the user when he opens the document. I should be able to process them using C#.NET.

    I tried adding custom xml tag in w: sdtconent tag of content control like,

                 <w: sdtContent>

                            <w: p w: rsidR="0091531A" w: rsidRDefault="006E63CD">

                                <w: pPr>

                                  <w: tabs>

                                      <w:tab w: val="left" w: pos="2220" />

                                      <w:tab w: val="left" w: pos="2340" />

                                      <w:tab w: val="left" w: pos="2790" />

                                  </w: tabs>

                                </w: pPr>

                             <w: r w: rsidRPr="00AB57F9">

                                 <w: rPr>

                                    <w: b />

                                  </w: rPr>

                                  <w: t>Analysis</w: t>

                              </w: r>

                            </w: p>  

                           <w: customXml w:element="tcProperyId.1111"/> 

                             <w:customXml w:element="tcPropertyName.object_name"/>

                             <w:customXml w:element="tcObjectId.45678"/>

                             <w:customXml w:element="isTcdirty.false"/>

                    </w: sdtContent>

    But this added extra space for each element when I opened the document. And if user deletes this space considering as blank then I lose all these elements. And, if user has “Show XML tags in the document” selected (i.e. on XML structure pan of developer tab), all this element are shown.

    Even i tried add these key-value pair as attribute on w: sdt element itself like,

    <w: body>

    <w: sdt  w: tcProperyId="1111" w: tcPropertyName="objname" w: tcObjectId="45678" w: isTcdirty="false">

    </w : sdt>

    </w : body>

    These attribute get lost whenever i modify the value of content control and save the word document.

    Does there any other way by which I could save all above properties as key-value paper on content control and access it programmatically.




    Monday, April 7, 2008 12:54 PM