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

Free Support Forum - aspose.com

ComboBoxField overwriting selection

I’m using version 18.11 of the product.

I’m using the product to set values in forms. Text fields, Radio button fields, etc, work just fine. However, if I’m running into issues when attempting to set the value for a Combo Box field if there is another Combo Box field with the same options.

What I’m experiencing:
Combo Box field 1 is named “Select 1”
Combo Box field 2 is named “Select 2”
Both combo box fields have a separate list of items but both lists are essentially the same, meaning they each have options named “option 1”, “option 2”, “option 3”, etc.

I set the value of “Select 1” to “option 2”.
I set the value of “Select 2” to “option 1”.
I verify in the watch window that everything looks fine so far.

I save the document to a file stream using the save method.
When I open the form both “Select 1” and “Select 2” show “option 1” selected.

What seems to be happening, is whichever option I select 2nd is overwriting the other option. If I was doing this on the same field I would expect this behavior. However, since these are both uniquely named distinct fields, I wouldn’t expect the option for Select 1 to overwrite the option for Select 2 and vice versa.


Thanks for contacting support.

Would you please share a sample PDF document along with sample code snippet which you are using at your side. We will test the scenario in our environment and address it accordingly.

(F) Tier 2 Data Gathering- Academic Strengths, Challenges & Strategies Attempted Checklist.pdf (321.6 KB)

    public MemoryStream GetPopulatedDocument(DocumentData data)
        MemoryStream flattenedFileStream = new MemoryStream();
        Byte[] file;

        using (FileStream stream = new FileStream($"{DocumentPath}{data.FileName}", FileMode.Open, FileAccess.Read))
            file = new Byte[stream.Length];
            stream.Read(file, 0, (int)stream.Length);

        using (Document document = new Document(new MemoryStream(file)))
            foreach (String key in data.FieldValues.Keys)
                SetFieldValue(document, key, data.FieldValues[key]);


        return flattenedFileStream;
    private void SetFieldValue(Document document, String key, String value)
        //Field field = document.Form[key] as Field;
        foreach (Field field in document.Form)
            // Ignore case and ignore the leading underscore on the key if the system field does not have it.
            if (field.PartialName.ToLower() == key.ToLower() || field.PartialName.ToLower() == key.Remove(0, 1).ToLower())
                field.Value = value;


Thanks for sharing requested information.

We have tested the scenario in our environment and were able to reproduce the similar issue. Therefore, we have logged it as PDFNET-45653 in our issue tracking system for the sake of correction. We will further investigate the issue in details and keep you posted with the status of its resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.