How do I prevent the image from being deleted when modifying word document

Home Forums Open-Xml-Sdk How do I prevent the image from being deleted when modifying word document

This topic contains 1 reply, has 2 voices, and was last updated by  Howard Rubin 7 years, 9 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3548

    mo7
    Participant

    Hi there.

    Firstly.. I’m new to openxml so please forgive me if my terminology isn’t correct.
    I have a word document that I want to use for mail merge.
    Some of the mail merge fields are within a a shape field Before Mail Merge (Template)

    Now I run the code I found on the following site Fill Mergefields in .docx Documents without Microsoft Word

    The code then basically converts the ComplexField types to SimpleField types. We do this for backward compatibilty for older documents.
    Now … the code works great. Except when a field is within a shape. Then the result is as follows
    After mail merge

    So basically what happens in the c# code the ComplexField is replace with a SimpleField and this works great except when a field is within a shape. So after I run the mail merge, all the fields are correctly filled in, but the new document doesn’t contain the shape as well as the Field (e.g. BankSortCode in image of “Before Mail Merge” in this post.

    Can you please tell me why this occurs and how to prevent it. I need the shape in the new document that is created after the mail merge occurs as well as the field to be filled in that is contained in it.

    #3553

    Howard Rubin
    Participant

    Using the Open XML SDK Productivity Tool, compare correct before and after docx or other ooxml files. This will show the XML difference plus the code to convert from one to the other.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.