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

Free Support Forum - aspose.com

How to manipulate ComboBoxField options

I need to update a ComboBoxField by removing all existing options (clearing them) and adding my own list. I’m using a native Pdf.Document object.


I see in Facades FormEditor that it has the AddListItem and DelListItem, but I don’t know what existing options are there to remove. Is there just a Clear method I’m not seeing?

Is there going to be a performance issue if I load a lot of options, for example 100-200 list items or more?


Also, I assume combo boxes only have values. I’d really like to have code and descriptions where the value returned is the Code, but shows the user the Description. Is that possible?

Thanks,
Mike

Hi Mike,


Thanks for using our API’s.

Please try using following code snippet to get values/options from ComboBox field. Please note that in order to properly execute the code, you need to specify correct field name. In case you are not certain about field names, then please try using the instructions specified over Identifying form fields names

[C#]

// Instantiate Document Object<o:p></o:p>

Document doc = new Document("c:/pdftest/OrderFormTest.pdf");

//TextBoxField textBoxField = pdfDocument.Form["Finishing"] as TextBoxField;

ComboBoxField comboField = doc.Form["Item Name"] as ComboBoxField;

foreach (Option option in comboField.Options)

{ Console.WriteLine(option.Name);
}

How do I clear all the existing options? There is no Remove function on the OptionsCollection. Nor in the Fascade FormsEditor.

Hi Mike,


Thanks for your feedback. We are looking into it and will update you soon.

Best Regards,

Hi Mike,


We are sorry for the delayed response. After initial investigation, we have logged an enhancement ticket PDFNEWNET-39373 for you requirement to remove existing options form ComboBoxField. We will notify you as soon as it is resolved.

We are sorry for the inconvenience caused.

Best Regards,