Dynamic mergefield names

Last post 12-09-2010, 10:45 AM by AndreyN. 3 replies.
Sort Posts: Previous Next
  •  12-09-2010, 9:43 AM 272988

    Dynamic mergefield names .NET

    I'm trying to create a dynamic mail merge field as documented here: http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/field-update.html

    but I'm not getting very far.

    My merge field looks like this:

    { MERGEFIELD { IF { MERGEFIELD Test } = "Test" "Field1" "Field2" } }

    And my code is 

    doc.MailMerge.Execute(new string[] { "Test", "Field1", "Field2" }, new object[] { "Test", "True", "False" });

    But it's not being replaced (i.e. I'd expect the whole thing to be replaced with "True"). What am I doing wrong/not doing?
    Filed under: conditional field;merge
     
  •  12-09-2010, 10:08 AM 273000 in reply to 272988

    Re: Dynamic mergefield names

    Hi

     

    Thanks for your request. As I can see all works as expected, let me clarify:

     

    1.

     

    doc.MailMerge.Execute(new string[] { "Test", "Field1", "Field2" }, new object[] { "Test", "True", "False" });

     

    IF Test = Test -> Field1 and replaced by True

     

    2.

     

    doc.MailMerge.Execute(new string[] { "Test", "Field1", "Field2" }, new object[] { "whatever", "True", "False" });

     

    IF whatever = Test -> Field2 and replaced by False

     

    Hope this helps.

     

    Best regards,


    Andrey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  12-09-2010, 10:14 AM 273002 in reply to 273000

    Re: Dynamic mergefield names

    Attachment: Present (inaccessible)
    Hmm I can't get this to work. Could you tell me what is wrong with my template (attached)?
     
  •  12-09-2010, 10:45 AM 273013 in reply to 273002

    Re: Dynamic mergefield names

    Attachment: Present (inaccessible)

    Hi

     

    Thank you for additional information. Please see the attached template.

    Please let me know if you need any further assistance. I will be glad to help you.

     

    Best regards,


    Andrey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
View as RSS news feed in XML