We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Pdf 6.3.0.0 - ComboBoxField AddOption method issue

I've this code below:
ComboBoxField wt1NameNumber = (ComboBoxField)doc.Form["frmMain[0].Page1[0].WT1NameNumber[0]"];

ComboBoxField wt2NameNumber = (ComboBoxField)doc.Form[“frmMain[0].Page1[0].WT2NameNumber[0]”];
ComboBoxField wt3NameNumber = (ComboBoxField)doc.Form[“frmMain[0].Page1[0].WT3NameNumber[0]”];
ComboBoxField wt4NameNumber = (ComboBoxField)doc.Form[“frmMain[0].Page1[0].WT4NameNumber[0]”];

foreach (Employee emp in employees)
{
wt1NameNumber.AddOption(emp.Id.ToString(), emp.FullNameNumber);
wt2NameNumber.AddOption(emp.Id.ToString(), emp.FullNameNumber);
wt3NameNumber.AddOption(emp.Id.ToString(), emp.FullNameNumber);
wt4NameNumber.AddOption(emp.Id.ToString(), emp.FullNameNumber);
}

 
I’m getting “Object reference not set to an instance of an object.” when it hits >> wt1NameNumbere.AddOption(emp.Id.ToString(), emp.FullNameNumber);
I’ve checked that emp is not null, obviously employess is not null, emp.Id is not null, emp.FullNameNumber is not null
 
Stack Trace:
at ..(String , String )
at Aspose.Pdf.InteractiveFeatures.Forms.OptionCollection.(String , String )
at Aspose.Pdf.InteractiveFeatures.Forms.ChoiceField.AddOption(String export, String name)

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

Please create a sample application with your complete sample code and template PDF file (if any) and share with us. This will help us figure out the issue.

Thank You & Best Regards,