com.aspose.words
Class FormFieldCollection

java.lang.Object
    extended by com.aspose.words.FormFieldCollection
All Implemented Interfaces:
java.lang.Iterable

public class FormFieldCollection 
extends java.lang.Object

A collection of FormField objects that represent all the form fields in a range.

Example:

Shows how to get a collection of form fields.
Document doc = new Document(getMyDir() + "FormFields.doc");
FormFieldCollection formFields = doc.getRange().getFormFields();

Property Getters/Setters Summary
intgetCount()
           Returns the number of form fields in the collection.
FormFieldget(int index)
           Returns a form field at the specified index.
FormFieldget(java.lang.String bookmarkName)
           Returns a form field by bookmark name.
 
Method Summary
voidclear()
           Removes all form fields from this collection and from the document.
java.util.Iteratoriterator()
           Returns an enumerator object.
voidremove(FormField formField)
           Removes the specified form field from the document.
voidremove(java.lang.String formField)
           Removes a form field with the specified name.
voidremoveAt(int index)
           Removes a form field at the specified index.
 

Property Getters/Setters Detail

getCount

public int getCount()
Returns the number of form fields in the collection.

get

public FormField get(int index)
Returns a form field at the specified index.

The index is zero-based.

Negative indexes are allowed and indicate access from the back of the collection. For example -1 means the last item, -2 means the second before last and so on.

If index is greater than or equal to the number of items in the list, this returns a null reference.

If index is negative and its absolute value is greater than the number of items in the list, this returns a null reference.

Parameters:
index - An index into the collection.

get

public FormField get(java.lang.String bookmarkName)
Returns a form field by bookmark name. Returns null if the form field with the specified bookmark name cannot be found.
Parameters:
bookmarkName - Case-insensitive bookmark name.

Method Detail

clear

public void clear()
          throws java.lang.Exception
Removes all form fields from this collection and from the document.

iterator

public java.util.Iterator iterator()
Returns an enumerator object.

remove

public void remove(FormField formField)
           throws java.lang.Exception
Removes the specified form field from the document. If there is a bookmark associated with the form field, the bookmark is not removed.
Parameters:
formField - The formField to remove.

remove

public void remove(java.lang.String formField)
           throws java.lang.Exception
Removes a form field with the specified name. If there is a bookmark associated with the form field, the bookmark is not removed.
Parameters:
formField - The case-insensitive name of the form field to remove.

removeAt

public void removeAt(int index)
             throws java.lang.Exception
Removes a form field at the specified index. If there is a bookmark associated with the form field, the bookmark is not removed.
Parameters:
index - The zero-based index of the form field to remove.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.