Free Support Forum - aspose.com

Issue in reading form fields in word file

Dear sir

I have created a word template containing several form fields. The template containes several tables and some question and answers. I have created text form field and drop down list form fields. I am trying to read the form fields using Aspose. word and insert it in to a SQL database. But Aspose.Word does not read all the form fields in the template. It stops at a point and it is not reading the form fields below a point. I am not sure what criteria its using to determine that. But when I add fields horizontally in a line, it reads them, but when I add fields vertically one below the other it does not read them. I don't know what the issue is, can some one help ASAP. See the code below,also attached the Template

Dim license As Aspose.Cells.License = New Aspose.Cells.License()

license.SetLicense("Aspose.Total.lic")

Dim wdoc As Aspose.Words.Document = New Aspose.Words.Document("m:\Raj\PIF TEM.doc")

Dim documentFormFields As Aspose.Words.Fields.FormFieldCollection = wdoc.Range.FormFields

Me.Label1.Text = documentFormFields.Count.ToString + " LABEL 1
"

Me.Label2.Text = "


LABEL 2
"

For Each formField2 As FormField In documentFormFields

Me.Label1.Text += "
" + i.ToString + " " + formField2.Name + " >>>>>> "

Me.Label1.Text += formField2.Result

Next

Thanks.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words 9.0.0. The latest version you can download here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

I use the following code for testing:

Document doc = new Document("PIF+TEM.doc");

FormFieldCollection fFieldColl = doc.Range.FormFields;

foreach (FormField fField in fFieldColl)

{

Console.WriteLine(fField.Name + " = " + fField.Result);

}

Best regards,

Dear Andrew,

Thanks a lot for your prompt response, really appreciate it.

I downloaded the latest version of Aspose.Words.9.0.0.But I am still facing the same problem, let me explain the issue in detail.

Attached here with is the word template file.

I totally have created 118 fields in the template.

I am able to read 111 fields properly. All fields in table 1(INDICATIVE CALENDAR) and Table 2(Project Framework) were read properly.

In Table 3 (: INDICATIVE CO FINANCING FOR THE PROJECT BY SOURCE AND BY NAME), its not reading any fields inside this table. It stops at the field next to the heading which is QUES_B.

Can you please confirm if you were able to read all the 118 fields, if yes, what is that I am missing then. I have sent you the code I used also.

Please check and let me know.

My advanse thanks.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. The problem might occur because you are using Apsose.Words in evaluation mode and document is truncated. There is evaluation limitation of maximum number of paragraphs in the document. You should see the following text in the output documents (if you save it after proccessing).

This document was truncated here because it was created using Aspose.Words in Evaluation Mode.

As I can see in your code, you applied Aspose.Total license only for Aspose.Cells. But you need to apply license for all Aspose products you use in your application.

Best regards.

Dear Alexey,

Thanks very much for your quick response and the hint for the solution. It looks like the problem is solved now. We have a Aspose Total license and we replaced the below line of code

Dim license As Aspose.Cells.License = New Aspose.Cells.License()

to the one below, the problem is solved.

Dim license As Aspose.Words.License = New Aspose.Words.License()

Thanks very much for your immediate respone and your help in solving the issue. really really appreciated.

Best Regards