Hi,
I tried to set a Value to a PdfComboBoxField in a Pdf-Form:
Code: Visual Basic.NET
Public Function SetzePdfFormularFelder(strPdfVorlageDatei As String,
strPdfAusgabeDatei As String,
dicFelder As Dictionary(Of String, String)
) As Boolean
Try
Dim doc As New PdfDocument(strPdfVorlageDatei)
For Each fld In doc.Fields
If dicFelder.ContainsKey(fld.FullName) Then
fld.Value = dicFelder(fld.FullName)
fld.Modified()
End If
Next
doc.Save(strPdfAusgabeDatei)
Return True
Catch ex As Exception
ProtokolliereFehler(ex)
Throw
End Try
End Function
For all PdfTextField´s it works. But to set the value in an ComboBox will be ignored. So in a second way, I tried
to set the SelectedIndex. But it won´t be saved anymore:
Code: Visual Basic.NET
For Each fld In doc.Fields
Select Case True
Case TypeOf fld Is EO.Pdf.PdfComboBoxField
Dim fldListField As EO.Pdf.PdfComboBoxField
fldListField = TryCast (fld, EO.Pdf.PdfComboBoxField)
fldListField.SelectedIndex = 6
fldListField.Modified()
Case Else
fld.Value = dicFelder(fld.FullName)
fld.Modified()
End Select
I tried the same with an other library from a other manufacturer with that same PDF and it works.
The librarys, I tried are EO.Total.2019.0.83.0.msi and EO.Total.2019.1.25.0.msi.
Best regards
Josh