menu

Document Processing

PdfLoadedListItemCollection Class - C# PDF Library API Reference | Syncfusion

    Show / Hide Table of Contents

    PdfLoadedListItemCollection Class

    Represents a collection of list box field items.

    Inheritance
    System.Object
    PdfCollection
    PdfLoadedListItemCollection
    Implements
    System.Collections.IEnumerable
    Inherited Members
    PdfCollection.Count
    PdfCollection.GetEnumerator()
    PdfCollection.List
    Namespace: Syncfusion.Pdf.Parsing
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public class PdfLoadedListItemCollection : PdfCollection, IEnumerable
    Examples
    //Load an existing document.
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Getting the 'course' list box field          
    PdfLoadedListBoxField listField = doc.Form.Fields["Course"] as PdfLoadedListBoxField;       
    // List field item Collection
    PdfLoadedListItemCollection listItemCollection = listField.Values;
    // Create a new list item
    PdfLoadedListItem listItem = new PdfLoadedListItem("Oracle", "Oracle");
    // Adding item in collection
    listItemCollection.Add(listItem);            
    doc.Save("LoadedForm.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Getting the 'course' list box field          
    Dim listField As PdfLoadedListBoxField = TryCast(doc.Form.Fields("Course"), PdfLoadedListBoxField)
    ' List field item Collection
    Dim listItemCollection As PdfLoadedListItemCollection = listField.Values
    ' Create a new list item
    Dim listItem As PdfLoadedListItem = New PdfLoadedListItem("Oracle", "Oracle")
    ' Adding item in collection
    listItemCollection.Add(listItem)
    doc.Save("LoadedForm.pdf")
    doc.Close(True)

    Properties

    Item[Int32]

    Gets the PdfLoadedListItem at the specified index.[Read-Only]

    Declaration
    public PdfLoadedListItem this[int index] { get; }
    Parameters
    Type Name Description
    System.Int32 index
    Property Value
    Type
    PdfLoadedListItem
    Examples
    //Load an existing document.
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");         
    // Getting the 'course' list box field
    PdfLoadedListBoxField listField = doc.Form.Fields["Course"] as PdfLoadedListBoxField;
    // List field item Collection
    PdfLoadedListItemCollection listItemCollection = listField.Values;
    // Getting the first item from the list item collection
    PdfLoadedListItem listItem = listItemCollection[0];
    listItem.Value = "C#.NET";
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document.
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Getting the 'course' list box field
    Dim listField As PdfLoadedListBoxField = TryCast(doc.Form.Fields("Course"), PdfLoadedListBoxField)
    ' List field item Collection
    Dim listItemCollection As PdfLoadedListItemCollection = listField.Values
    ' Getting the first item from the list item collection
    Dim listItem As PdfLoadedListItem = listItemCollection(0)
    listItem.Value = "C#.NET"
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedListBoxField
    PdfLoadedDocument

    Methods

    Add(PdfLoadedListItem)

    Inserts an list item at the end of the collection.

    Declaration
    public int Add(PdfLoadedListItem item)
    Parameters
    Type Name Description
    PdfLoadedListItem item

    a PdfLoadedListItemobject to be added to collection.

    Returns
    Type Description
    System.Int32

    The index of item.

    Examples
    //Load an existing document.
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");
    // Getting the 'course' list box field          
    PdfLoadedListBoxField listField = doc.Form.Fields["Course"] as PdfLoadedListBoxField;       
    // List field item Collection
    PdfLoadedListItemCollection listItemCollection = listField.Values;
    // Create a new list item
    PdfLoadedListItem listItem = new PdfLoadedListItem("Oracle", "Oracle");
    // Adding item in collection
    listItemCollection.Add(listItem);            
    doc.Save("LoadedForm.pdf");
    doc.Close(true);
    'Load an existing document
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Getting the 'course' list box field          
    Dim listField As PdfLoadedListBoxField = TryCast(doc.Form.Fields("Course"), PdfLoadedListBoxField)
    ' List field item Collection
    Dim listItemCollection As PdfLoadedListItemCollection = listField.Values
    ' Create a new list item
    Dim listItem As PdfLoadedListItem = New PdfLoadedListItem("Oracle", "Oracle")
    ' Adding item in collection
    listItemCollection.Add(listItem)
    doc.Save("LoadedForm.pdf")
    doc.Close(True)
    See Also
    PdfLoadedListBoxField
    PdfLoadedDocument

    Clear()

    Clears the item collection.

    Declaration
    public void Clear()
    Examples
    //Load an existing document.
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");         
    // Getting the 'course' list box field
    PdfLoadedListBoxField listField = doc.Form.Fields["Course"] as PdfLoadedListBoxField;
    // List field item Collection
    PdfLoadedListItemCollection listItemCollection = listField.Values;
    // Clears the collection
    listItemCollection.Clear();
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document.
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Getting the 'course' list box field
    Dim listField As PdfLoadedListBoxField = TryCast(doc.Form.Fields("Course"), PdfLoadedListBoxField)
    ' List field item Collection
    Dim listItemCollection As PdfLoadedListItemCollection = listField.Values
    ' Clears the collection
    listItemCollection.Clear()
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedListBoxField
    PdfLoadedDocument

    Insert(Int32, PdfLoadedListItem)

    Inserts the list item at the specified index.

    Declaration
    public void Insert(int index, PdfLoadedListItem item)
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    PdfLoadedListItem item

    The item.

    Examples
    //Load an existing document.
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");         
    // Getting the 'course' list box field
    PdfLoadedListBoxField listField = doc.Form.Fields["Course"] as PdfLoadedListBoxField;
    // List field item Collection
    PdfLoadedListItemCollection listItemCollection = listField.Values;
    // Getting the first item from the list item collection
    PdfLoadedListItem listItem = listItemCollection[0];
    // Insert the item at first index
    listItemCollection.Insert(0, listItem);   
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document.
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Getting the 'course' list box field
    Dim listField As PdfLoadedListBoxField = TryCast(doc.Form.Fields("Course"), PdfLoadedListBoxField)
    ' List field item Collection
    Dim listItemCollection As PdfLoadedListItemCollection = listField.Values
    ' Getting the first item from the list item collection
    Dim listItem As PdfLoadedListItem = listItemCollection(0)
    ' Insert the item at first index
    listItemCollection.Insert(0, listItem)
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedListBoxField
    PdfLoadedDocument

    RemoveAt(Int32)

    Removes the list item at the specified index.

    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    System.Int32 index

    The index.

    Remarks

    Throws IndexOutOfRange exception if the index is out of bounds.

    Examples
    //Load an existing document.
    PdfLoadedDocument doc = new PdfLoadedDocument("SourceForm.pdf");         
    // Getting the 'course' list box field
    PdfLoadedListBoxField listField = doc.Form.Fields["Course"] as PdfLoadedListBoxField;
    // List field item Collection
    PdfLoadedListItemCollection listItemCollection = listField.Values;
    // Remove the first item
    listItemCollection.RemoveAt(0);
    doc.Save("Form.pdf");
    doc.Close(true);
    'Load an existing document.
    Dim doc As PdfLoadedDocument = New PdfLoadedDocument("SourceForm.pdf")
    ' Getting the 'course' list box field
    Dim listField As PdfLoadedListBoxField = TryCast(doc.Form.Fields("Course"), PdfLoadedListBoxField)
    ' List field item Collection
    Dim listItemCollection As PdfLoadedListItemCollection = listField.Values
    ' Remove the first item
    listItemCollection.RemoveAt(0)
    doc.Save("Form.pdf")
    doc.Close(True)
    See Also
    PdfLoadedListBoxField
    PdfLoadedDocument

    Implements

    System.Collections.IEnumerable

    See Also

    PdfCollection
    PdfLoadedListBoxField
    PdfLoadedDocument
    Back to top Generated by DocFX
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved