none
how to bind openXML feed data to word template using content control tool kit 2007 RRS feed

  • Question

  • Hi,

    I need some clear information about Content control tool kit. I have created word document with content controls & generated custom XML using VS2010 C# & used feeddata command.

    When i open the generated file in Content control kit Edit Menu, I could able to see all values which are generated using C#. But binding is not done.

    what are all the steps need to be followed to bind custom XML generated by using C#.

    Note: I tried drag & drop in the generated file. It works for that file. but when i generate again, no data displayed.

    Thanks

    Monday, May 28, 2012 1:47 PM

Answers

  • Hi Dharnima,

    Thanks for posting in the MSDN Forum.

    It seems that you aren't able to use feeddata to bind data of xml to contentcontrol. you need creat a customxmlpart first like that:

            public void CreateCustomXmlPropertiesPart(CustomXmlPropertiesPart part)
            {
                GeneratePartContent(part);
    
            }
    
            // Generates content of part.
            private void GeneratePartContent(CustomXmlPropertiesPart part)
            {
                Ds.DataStoreItem dataStoreItem1 = new Ds.DataStoreItem(){ ItemId = "{ed74cdc0-5d4c-4101-998a-973e14a3540a}" };
                dataStoreItem1.AddNamespaceDeclaration("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml");
    
                part.DataStoreItem = dataStoreItem1;
            }

    Then use databinding in sdtblock:

                DataBinding dataBinding1 = new DataBinding(){ XPath = "/root[1]/combo[1]/item[1]", StoreItemId = "{ed74cdc0-5d4c-4101-998a-973e14a3540a}" };
                SdtProperties sdtProperties1 = new SdtProperties();
                sdtProperties1.Append(dataBinding1);

    Have a good day,

    Tom


    Tom Xu [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, May 29, 2012 2:20 AM
    Moderator