Free Support Forum - aspose.com

Non-unique field name when lots of fields are on form

I have a large table that generates about 30 rows of 6 check boxes. The snippet of code is as follows (in C#). This gives you an idea of how I add the check boxes. I initialize them in an initialization method.

int NumberOfRows = 36;

for (int i =0; i < NumberOfRows; i++)

{

... previous code ...

rows[i].Cells.Add("");
rows[i].Cells[2].Paragraphs.Add(checkBox1[checkBoxCount]);
rows[i].Cells[2].Alignment = AlignmentType.Center;
rows[i].Cells[2].VerticalAlignment = VerticalAlignmentType.Center;
rows[i].Cells.Add("");
rows[i].Cells[3].Paragraphs.Add(checkBox2[checkBoxCount]);
rows[i].Cells[3].Alignment = AlignmentType.Center;
rows[i].Cells[3].VerticalAlignment = VerticalAlignmentType.Center;
rows[i].Cells.Add("");
rows[i].Cells[4].Paragraphs.Add(checkBox3[checkBoxCount]);
rows[i].Cells[4].Alignment = AlignmentType.Center;
rows[i].Cells[4].VerticalAlignment = VerticalAlignmentType.Center;
rows[i].Cells.Add("");
rows[i].Cells[5].Paragraphs.Add(checkBox4[checkBoxCount]);
rows[i].Cells[5].Alignment = AlignmentType.Center;
rows[i].Cells[5].VerticalAlignment = VerticalAlignmentType.Center;
rows[i].Cells.Add("");
rows[i].Cells[6].Paragraphs.Add(checkBox5[checkBoxCount]);
rows[i].Cells[6].Alignment = AlignmentType.Center;
rows[i].Cells[6].VerticalAlignment = VerticalAlignmentType.Center;
rows[i].Cells.Add("");
rows[i].Cells[7].Paragraphs.Add(checkBoxComment[checkBoxCount]);
rows[i].Cells[7].Alignment = AlignmentType.Center;
rows[i].Cells[7].VerticalAlignment = VerticalAlignmentType.Center;
checkBoxCount++;

... rest of code ...

}

I noticed that someone else noticed this problem in July. I downloaded the new .dll and added it as a reference in C#. (see http://www.aspose.com/community/forums/post/186196/form-fields-in-tables.aspx). However, the problem still occurs. Is there something that I configured wrong? I already installed Aspose.pdf and replaced the dll in the Solution Explorer. Or is there another bug? Any help would be appreciated!


This message was posted using Aspose.Live 2 Forum

Hi Bill,

Thank you very much for considering Aspose.

I have tested the issue at my end and couldn’t find any problem while adding more than 36 rows with the check boxes. As long as you keep the names of the check boxes unique there shouldn’t be a problem. I have tested the issue with latest version of Aspose.Pdf (4.1.0.0).

Can you please share the complete code snippet with us so we could see the issue at our end? There seems some problem with the way you’re naming the check boxes.

We’re sorry for the inconvenience.
Regards,


I’d rather not show the whole code snippet since there are a lot of objects that are in libraries on my local machine, but I actually put 12 check boxes in the each row. There are 25 total rows with check boxes – 21 rows with 2 instances of each check box array and 4 rows with 1 instance of each check box array.

I have 6 arrays of FormFields – size 46
I gave them variable names checkBox1[0-45], checkBox2[0-45], … , checkBox6[0-45].
Their field names are “FirstCheckBox0” to “FirstCheckBox45”, “SecondCheckBox0” to “SecondCheckBox45”, … , “SixthCheckBox0” to “SixthCheckBox45”.

I have triple-checked, and no form field has the same name. The problem seems to occur when I set a lot of attributes to the components such as FormWidth and FormHeight. If I comment out the attributes, the problem goes away. To work around, I made extensions of Aspose objects that contain the attributes; however, it would be nice to figure out what is going on.

The error I get is with FirstCheckBox41 or FirstCheckBox39. As mentioned earlier, this happens when I set a lot of attributes or put a lot of form field components in a Table object.

Hi Bill,

We’re looking into the matter, however in order to understand and then resolve the problem we need to reproduce the issue at our end. For that matter, we would need your help. Can you please create a sample project with the bare minimum code to create the PDF with the required table containing the check boxes just the way you’re trying to add it to your actual application; I’m afraid that while working with the issue at our end, we might not be dealing with the exact problem you’re facing at your end. So, a sample would be of great help.

We really appreciate your cooperation in this regard. And, we’re looking forward to help you out.
Regards,

I created a bare bones application that reproduces the problem. It produces 65 rows of 6 check boxes. All of the check boxes have unique names. However, it throws an ApplicationException – Non-unique field name: FirstCheckBox0, which is the same problem I encountered earlier. Hope this helps you out!

Bill

Hi Bill,

Thank you for considering Aspose.

Please note that in the line
tableRows[i] = bodyTable.Rows.Add();
the row is created and added into the table. So in the
bodyTable.Rows.Add(tableRows[i]);
it is added again. If you remove the second line then it works.

Tommy,

I checked the code that I submitted, and I did not do what you said I did in the project. I don't know what code you were looking at. I only call bodyTable.Rows.Add() once in the loop and still get an ApplicationException. It seems to happen when I have a lot of FormField objects in a table. There seems to be a bug in the library. If you could attach the latest Aspose.pdf.dll in a zipped file, I would greatly appreciate it.

Hi Bill,

We have just published hotfix 4.1.1. You can try it. You can also print the name of the fields before save the PDF.

Where can I download the hotfix? Could you please give me a link? Also, what do you mean by “printing” the field names before saving the PDF? I’m sure I could figure out how, but I’m pretty pressed on time. Thanks in advance. I appreciate it.

I found the hotfix and am in the process of downloading. For the sake of other Aspose users, I will test my problem and tell you if my issue is resolved. Hopefully it is!

I tested a piece of code that I had been having trouble with and it does not get the ApplicationException. Thanks for the hot fix!.