Hi, I have a few checkbox form field in my word template…I was wondering how to set the ‘checked’ value of this form field using the Document Builder based on some values I read out of an XML file. Setting <> fields is no problem but the checkbox is not a <>. Also part of my code searches for all mergefields on the form using the wdoc.MailMerge.GetFieldNames() function…so the checkboxes are not returned in the string array.
Is there a way to search for all checkbox form fields and set them as you would a merge field.
Thanks
Setting checkboxes via mail merge process is not supported directly in our API. But I remember posting a good workaround for this some time ago. Please check the following thread:
https://reference.aspose.com/words/net/aspose.words.mailmerging/ifieldmergingcallback
Please try it and let me know if it helps you. If not I will be glad to update the code given there so that it could work for your case.
Best regards,
Yes I believe this will work, I can loop through and find all Checkbox type form fields then get the checkbox name then look up this name in my XML document (our logic says form fields names and mergefield names must match XML node element names) then evaluate the value of the xml element and set the result property of the checkbox…does this make sense to you?
thank you for your help.
Yes, just keep me posted of your progress. I will try to assist you on the way.
Best regards,