Table of Contents

Class PdfLoadedXfaListBoxField

Namespace
Syncfusion.Pdf.Xfa
Assembly
Syncfusion.Pdf.Portable.dll

Represents the loaded list box field of the XFA form.

public class PdfLoadedXfaListBoxField : PdfLoadedXfaStyledField
Inheritance
PdfLoadedXfaListBoxField
Inherited Members

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded list box field.
PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["listBoxField[0]"] as PdfLoadedXfaListBoxField;
//Set the list box selected index
loadedListBoxField.SelectedIndex = 1;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded list box field.
Dim loadedListBoxField As PdfLoadedXfaListBoxField = TryCast(TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm).Fields("listBoxField[0]"), PdfLoadedXfaListBoxField)
'Set the list box selected index
loadedListBoxField.SelectedIndex = 1
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

Constructors

PdfLoadedXfaListBoxField()

public PdfLoadedXfaListBoxField()

Properties

Items

Gets set the list items.

public List<string> Items { get; set; }

Property Value

List<string>

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded list box field.
PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["listBoxField[0]"] as PdfLoadedXfaListBoxField;
//Get the items of the list box field.
List<string> items = loadedComboBoxField.Items;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded list box field.
Dim loadedListBoxField As PdfLoadedXfaListBoxField = TryCast(TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm).Fields("listBoxField[0]"), PdfLoadedXfaListBoxField)
'Get the items of the list box
Dim items As List(Of String) = loadedListBoxField.Items
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

SelectedIndex

Gets or sets the default index of the list box field

public int SelectedIndex { get; set; }

Property Value

int

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded list box field.
PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["listBoxField[0]"] as PdfLoadedXfaListBoxField;
//Set the list box selected index
loadedListBoxField.SelectedIndex = 1;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded list box field.
Dim loadedListBoxField As PdfLoadedXfaListBoxField = TryCast(TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm).Fields("listBoxField[0]"), PdfLoadedXfaListBoxField)
'Set the list box selected index
loadedListBoxField.SelectedIndex = 1
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

SelectedItems

Gets or sets the items to multi select

public string[] SelectedItems { get; set; }

Property Value

string[]

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded list box field.
PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["listBoxField[0]"] as PdfLoadedXfaListBoxField;
//Get the selected items.
string[] selectedItems = loadedListBoxField.SelectedItems;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded list box field.
Dim loadedListBoxField As PdfLoadedXfaListBoxField = TryCast(TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm).Fields("listBoxField[0]"), PdfLoadedXfaListBoxField)
'Get the seleted items.
Dim selectedItems As String() = loadedListBoxField.SelectedItems
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

SelectedValue

Gets or sets the default value of the list box field

public string SelectedValue { get; set; }

Property Value

string

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded list box field.
PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["listBoxField[0]"] as PdfLoadedXfaListBoxField;
//Set the list box selected value
loadedListBoxField.SelectedValue = "English";
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded list box field.
Dim loadedListBoxField As PdfLoadedXfaListBoxField = TryCast(TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm).Fields("listBoxField[0]"), PdfLoadedXfaListBoxField)
'Set the list box selected value
loadedListBoxField.SelectedValue = "English"
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()

SelectionMode

Get the if the field is multi select or not

public PdfXfaSelectionMode SelectionMode { get; }

Property Value

PdfXfaSelectionMode

Examples

//Load the existing PDF document
PdfLoadedXfaDocument loadedDocument = new PdfLoadedXfaDocument("input.pdf");
//Load the existing XFA form
PdfLoadedXfaForm loadedForm = loadedDocument.XfaForm;
//Get the loaded list box field.
PdfLoadedXfaListBoxField loadedListBoxField = (loadedForm.Fields["subform1[0]"] as PdfLoadedXfaForm).Fields["listBoxField[0]"] as PdfLoadedXfaListBoxField;
//Get the selection mode
PdfXfaSelectionMode mode = loadedListBoxField.SelectionMode;
//Save the document
loadedDocument.Save("output.pdf");
//Close the document
loadedDocument.Close();
'Load the existing PDF document
Dim loadedDocument As New PdfLoadedXfaDocument("input.pdf")
'Load the existing XFA form
Dim loadedForm As PdfLoadedXfaForm = loadedDocument.XfaForm
'Get the loaded list box field.
Dim loadedListBoxField As PdfLoadedXfaListBoxField = TryCast(TryCast(loadedForm.Fields("subform1[0]"), PdfLoadedXfaForm).Fields("listBoxField[0]"), PdfLoadedXfaListBoxField)
'Get the seletion mode.
Dim mode As PdfXfaSeletionMode = loadedListBoxField.SelectionMode 
'Save the document
loadedDocument.Save("output.pdf")
'Close the document
loadedDocument.Close()