Need to associate content control binding with correct custom XML part RRS feed

  • Question

  • I have a program manipulating (Word 2007/2010) documents that have multiple custom xml parts. 2 of these custom xml parts are identified by namespaces that are known to my program.  Other parts may or may not have namespace identifications and my program does not want or need to access to those at all. 

    The document contains content controls with bindings to any one the custom xml parts. During processing, my program selects certain content controls and changes the bindings.  But I only want to touch the bindings that link to custom xml parts I know about.

    I see that in the w:dataBinding node there is a w:storeItemID attribute in addition the the w:xpath and it appears that it is identifying a particular custom XML part. What I can't figure out is how I find which storeItemID value(s) is associated with the custom XML part(s) that I care about.  I'm guesing that I need to access some metadata about my custom xml parts and the storeItemID will be part of that.

    Here is some code that I would change to limit the selection to the w:storeItemIDs that I care about, once I figure out what they are. 

    XmlNodeList lcXPathBindingNodeList = pcDocPkgPartXml.SelectNodes(".//w:sdt/w:sdtPr/w:dataBinding", mcNsMgr);

    Any ideas?

    Wednesday, August 1, 2012 9:57 PM


All replies