Free Support Forum - aspose.com

Support for Form Fields

Hi,

Does this product support MS-Word-like forms entry, consisting of "protected" fields (where users cannot type) and data entry regions (text boxes, check boxes, etc.) where users can enter text?

Basically, what we want to achieve is to have word templates set up with all kinds of form fields, and then bind database fields to the form regions. Some of these regions are supposed to be repeating and growable. Will the DocIO maintain the word template format while populating data, such as page numbering, section headers/footers, etc.

Regards,

Kanmani.

Please read the "Working with Form Fields" article to find out how to work with form fields in Aspose.Words:

http://www.aspose.com/Wiki/default.aspx/Aspose.Words/WorkingWithFormFields.html

Aspose.Words offers full support of autotext like page numbering and headers/footers management.

Hi,

Is it possible to merge the form fields with database?

There is no way to achieve it with one command and there is no universal way to do this. Generally, it can be done with some amount of coding, but you need to write specific code for each case.

Thanks for the response and your idea.

Any one, Can you please make a quite sample code implentation for Form fields merging by mail merge.

Regards,

Kanmani.

You need to compose a template relevant to your area of interest and send it to us in attachment. Then I can provide a sample code.

Hi,

I have attached the template document. The details about the employees are prsented in the template document. All the form field are merged in to the database. When I execute Mail merge all the record in the database can be merged in to the template.

Regards,

Kanmani.

To fill bookmarked form fields with data you should basically use the following code:

// fill FORMTEXT field with text

doc.Range.FormFields["Text1"].Result = "some text";

// check FORMCHECKBOX field

doc.Range.FormFields["Check1"].Result = "1";

You need to know that Aspose.Words MailMerge does not work on the form fields. So, if you want to fill form fields from the datasource you need to write your own Execute procedure. For example:

private void ExecuteFormFields(Document doc, DataTable table)

{

foreach(DataRow row in table.Rows)

{

FormField ff = doc.Range.FormFields[(string)row[0]];

if (ff != null)

{

ff.Result = (string)row[1];

}

}

}