none
How to replace content in template docx document using C# and Open XML SDK RRS feed

  • Question

  • Hi

    I have a "template" docx document which contains the desired layout, and wish to insert content using C#. The template has been created using Developer ribbon in MS Word. The snapshot of the template is given below.

    Please let me know how can I access the fields programmatically and populate it with data.

    Tuesday, May 27, 2014 11:05 AM

Answers

  • Hi Abhiroop

    You've asked this question in a forum that targets a tool for reading/writing Office content in closed files, leveraging the Office Open XML file format. I'm going to assume that's the technology you want to use, although the way your last sentence is phrased I'm not certain this is the case...

    My recommendation would be for you to have two documents: one with the data and the other without.

    Then you can use the Open XML SDK Productivity Tool to 1) compare the documents so that you can see where the change needs to be made and 2) see the code required to make this change in the appropriate Open XML Part.

    You can download the Productivity Tool: http://www.microsoft.com/en-us/download/details.aspx?id=30425


    Cindy Meister, VSTO/Word MVP, my blog

    Tuesday, May 27, 2014 5:42 PM
    Moderator