Back to Devexpress

PdfAcroFormFacade.GetListBoxFormField(String) Method

officefileapi-devexpress-dot-pdf-dot-pdfacroformfacade-dot-getlistboxformfield-x28-system-dot-string-x29.md

latest4.3 KB
Original Source

PdfAcroFormFacade.GetListBoxFormField(String) Method

Gets a specific list box form field’s properties.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Core.dll

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public PdfListBoxFormFieldFacade GetListBoxFormField(
    string fullName
)
vb
Public Function GetListBoxFormField(
    fullName As String
) As PdfListBoxFormFieldFacade

Parameters

NameTypeDescription
fullNameString

A form field’s name.

|

Returns

TypeDescription
PdfListBoxFormFieldFacade

An object that contains the form field’s properties.

|

Remarks

The PdfListBoxFormFieldFacade object contains form field and widget properties without access to the form field’s inner structure. Use the Widgets property to get the widget annotations’ settings associated with the form field.

The code sample below specifies the list box value and disables multiple selection:

csharp
using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf");

    PdfDocumentFacade documentFacade = pdfDocumentProcessor.DocumentFacade;
    PdfAcroFormFacade acroForm = documentFacade.AcroForm;
    PdfListBoxFormFieldFacade listField = acroForm.GetListBoxFormField("List");
    listField.MultiSelect = false;
    listField.Sorted = false;
    listField.Value = listField.Items[2].Value;
    pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf");
}
vb
Using pdfDocumentProcessor As New PdfDocumentProcessor()
  pdfDocumentProcessor.LoadDocument("Documents//FormDemo.pdf")

  Dim documentFacade As PdfDocumentFacade = pdfDocumentProcessor.DocumentFacade
  Dim acroForm As PdfAcroFormFacade = documentFacade.AcroForm
  Dim listField As PdfListBoxFormFieldFacade = acroForm.GetListBoxFormField("List")
  listField.MultiSelect = False
  listField.Sorted = False
  listField.Value = listField.Items(2).Value
  pdfDocumentProcessor.SaveDocument("FormDemo_new.pdf")
End Using

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetListBoxFormField(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

pdf-document-api-fill-interactive-form-fields/CS/PdfFormFilling/PdfFormFilling.cs#L59

csharp
PdfListBoxFormFieldFacade categoryField = acroForm.GetListBoxFormField("Category");
categoryField.Values = new List<string>() { "Entertainment", "Meals", "Morale" };

pdf-document-api-fill-interactive-form-fields/VB/PdfFormFilling/PdfFormFilling.vb#L53

vb
Dim categoryField As PdfListBoxFormFieldFacade = acroForm.GetListBoxFormField("Category")
categoryField.Values = New List(Of String)() From {"Entertainment", "Meals", "Morale"}

See Also

PdfAcroFormFacade Class

PdfAcroFormFacade Members

DevExpress.Pdf Namespace