We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Ask & Fill-In Fields in Word Document Mail Merge

Thread ID:

Created:

Updated:

Platform:

Replies:

116258 May 5,2014 02:03 AM UTC Feb 8,2018 10:22 AM UTC Windows Forms 3
loading
Tags: DocIO
Anthony Consolati
Asked On May 5, 2014 02:03 AM UTC

Hi

We have some merge document templates that include some Microsoft Word 'Ask' and 'Fill-in' fields. If merging through Word, these fields are popped up by the Word client, which obviously won't happen when using DocIO. 

Please can you advise the best way to:
a) get access to a list of these fields (including their 'prompt/question' text) so we can manually prompt the user in our client application
b) replace the field(s) in the final output with custom text

We have had some success with the ask fields using bookmarks, but would like to have your advise on the recommended way of handling these 2 field types. 

Many Thanks.





Sathish K [Syncfusion]
Replied On May 6, 2014 11:38 AM UTC

Hi Shamsul,

 

Thank you for your interest in Syncfusion products.

 

Regarding Mail merge with Ask & Fill-In Fields:

Currently DocIO performs mail merge operations with the Merge fields only and doesn’t have support for Ask and Fill-In fields during mail merge. We have logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We will update you when this feature has been implemented.

 

As Workaround kindly have all the fields as Merge fields in your template document in order to perform mail merge using DocIO.

 

Regarding the replacement of Merge field with Text:

We have prepared a sample to illustrate how to replace a merge field with custom text. Please find the attached sample and let us know if this helps you.

 

Please let us know if you have any other questions.

 

Regards,

Sathish


Attachment: Sample_456c29d8.zip

Fermin
Replied On February 7, 2018 02:49 PM UTC

Hi
I solve this creating this extension form


//Some using
...
//Namespace
...
//The Extenensions class
public static class Extensions
{
   public static List<WField> FindFields(this WordDocument document, Syncfusion.DocIO.FieldType fieldType = Syncfusion.DocIO.FieldType.FieldFillIn)
        {
            List<WField> fields = new List<WField>();
            FindFields(document.ChildEntities, fields, fieldType);
            return fields;
        }
        private static void FindFields(EntityCollection childEntities, List<WField> fields, Syncfusion.DocIO.FieldType fieldType = Syncfusion.DocIO.FieldType.FieldFillIn)
        {
            //Recorrer todas los hijos
            foreach (Entity entity in childEntities)
            {
                //Si es un campo del tipo que buscamos
                if ((entity is WField) && (entity as WField).FieldType == fieldType)
                {
                    //Lo añadimos a la lista
                    fields.Add((entity as WField));
                    //En principio no deberia de tener i
                }
                else
                {
                    //Si tiene hijos?
                    if (entity is ICompositeEntity)
                    {
                        //Buscamos recursivamente
                        FindFields((entity as ICompositeEntity).ChildEntities, fields, fieldType);
                    }
                }
            }
        }
        private static void EditField(WField field)
        {
          //Mus create this Form for edit then value
            using (FormEdit form = new FormEdit())
            {
               
                form.FiedValue = field.FieldValue;
                form.FieldText = field.Text;
                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    field.Text = form.FieldText;
                }
            }
        }
}

//Then can do this this document as WordDocument 
 List<WField> fieldFillIn = FindFields(document, Syncfusion.DocIO.FieldType.FieldFillIn);
foreach (WField field in fieldFillIn)
{
EditField(field);
}     
The code of the FormEdit is (Must create the components in the designer
 public partial class FormEdit : Form
    {
//Link to label
        public string FiedValue { get {
                return label1.Text;
            }
            set {
                label1.Text = value;
            }
        }
//link to Multiline TextBox
        public string FieldText
        {
            get
            {
                 return textBox1.Text;
            }
            set
            {
                textBox1.Text = value;
            }
        }
        public FormEdit()
        {
            InitializeComponent();
        }
         //Ok Button
        private void btOk_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            Close();
        }
       //Cancel button
        private void btCancel_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.Cancel;
            Close();
        }
    }


Mohanaselvam  Jothi [Syncfusion]
Replied On February 8, 2018 10:22 AM UTC

Hi Anthony,

Yes, you can also use this approach for replacing Fill-In Field with custom text.

Please let us know if you have any other questions.

Regards,
Mohanaselvam J
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;