Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Apr 16, 2019 1:54 pm

I'm trying to select a value from a list in the form but I tried everything from SelectedIndex & SelectedValue but when I save the file, the dropdown from the PDF turns into a textbox but with no value in it.

Code: Select all
               if (field.Name.ToLower() == "facilitystate")
               {
                  var listWidget = field as PdfComboBoxWidgetFieldWidget;
                  var PennsylvaniaIndex = 0;

                  for (var x = 0; x < listWidget.Values.List.Count; x++)
                  {
                     var widgetItem = listWidget.Values.List[x] as PdfListWidgetItem;

                     if (widgetItem.Value == "PA" || widgetItem.Text == "PA")
                     {
                        PennsylvaniaIndex = x;
                     }
                  }

                  listWidget.SelectedIndex = new[] { PennsylvaniaIndex };
                  listWidget.SelectedValue = "PA";
                  listWidget.SetName("PA");
               }

dipen1
 
Posts: 1
Joined: Thu Apr 11, 2019 3:18 pm

Wed Apr 17, 2019 6:16 am

Hi,

Thank you for contacting us.
After initial testing with the latest Spire.PDF Pack(Hot Fix) Version:5.4.9, I didn't find any issue on my side, the value was selected to "PA" successfully. If you were using an old version, I would suggest that you try the latest one. If the issue still occurs, please provide your input Pdf file as well as generated PDF to help us further look into your issue. You could send them to us via email ([email protected]). Thanks in advance.

Sincerely,
Nancy
E-iceblue support team
User avatar

nancy.yang
 
Posts: 184
Joined: Wed Apr 03, 2019 2:33 am

Fri Apr 19, 2019 10:20 am

Hi,

How is your issue now? Could you please give us some feedback at your convenience? Thanks in advance.

Sincerely,
Nancy
E-iceblue support team
User avatar

nancy.yang
 
Posts: 184
Joined: Wed Apr 03, 2019 2:33 am

Return to Spire.PDF

cron