com.aspose.words

Class GeneralFormatCollection

  • java.lang.Object
    • com.aspose.words.GeneralFormatCollection
  • All Implemented Interfaces:
    java.lang.Iterable
    public class GeneralFormatCollection 
    extends java.lang.Object

Represents a typed collection of general formats.

Property Getters/Setters Summary
intgetCount()
Gets the total number of the items in the collection.
intget(int index)
Gets a general format at the specified index. The value of the property is GeneralFormat integer constant.
 
Method Summary
voidadd(int item)
Adds a general format to the collection.
java.util.Iterator<GeneralFormat>iterator()
Returns an enumerator object.
voidremove(int item)
Removes all occurrences of the specified general format from the collection.
voidremoveAt(int index)
Removes a general format occurrence at the specified index.
 

    • Property Getters/Setters Detail

      • getCount

        public int getCount()
        
        Gets the total number of the items in the collection.
      • get

        public int get(int index)
        
        Gets a general format at the specified index. The value of the property is GeneralFormat integer constant.
        Parameters:
        index - The index of a general format.
        Returns:
        A general format.
    • Method Detail

      • add

        public void add(int item)
                throws java.lang.Exception
        Adds a general format to the collection.
        Parameters:
        item - A GeneralFormat value. A general format.

        Example:

        Shows how to formatting fields
        Document doc = new Document();
        DocumentBuilder builder = new DocumentBuilder(doc);
        
        Field field = builder.insertField("MERGEFIELD Date");
        
        FieldFormat format = field.getFormat();
        
        format.setDateTimeFormat("dddd, MMMM dd, yyyy");
        format.setNumericFormat("0.#");
        format.getGeneralFormats().add(GeneralFormat.CHAR_FORMAT);
      • iterator

        public java.util.Iterator<GeneralFormat> iterator()
        Returns an enumerator object.
      • remove

        public void remove(int item)
                   throws java.lang.Exception
        Removes all occurrences of the specified general format from the collection.
        Parameters:
        item - A GeneralFormat value. A general format.
      • removeAt

        public void removeAt(int index)
                     throws java.lang.Exception
        Removes a general format occurrence at the specified index.
        Parameters:
        index -