none
How to replace a section in a word template with multiple fields C# RRS feed

  • Question

  • Hi

    I'm not sure if this is the right place to ask this, but I couldn't find the right place, feel free to move it to another place if this isn't the right one.


    I'm creating a C# application that fills the MergeFields defined on a MS Word document with data from an external Data Source.

    I'm using the OpenXml SDK and everything works fine when replacing single fields.

    What I want to do is, to have a section with several MergeFields defined and being able to copy such section several times according to the input data.

    e.g.
    I can have in the document a paragraph containing a product information with several MergeFields, but in the data I have information for several products, I want to generate as many paragraphs in the output document as products are in the input data.

       Product: [[product-name]], amount: [[product-amount]], price: [[product-price]]

    Is there something like a "logical section" in a Word document to wrap the paragraph? if not, what would be your advice to do this?

    Any help will be very appreciated, thanks!
    Tuesday, October 6, 2009 8:20 PM

Answers