ASPOSE home

com.aspose.words
Class HeadersFooters

java.lang.Object
  extended by NodeCollection
      extended by com.aspose.words.HeadersFooters
All Implemented Interfaces:
INodeCollection

public class HeadersFooters
extends NodeCollection

Provides typed access to HeaderFooter nodes of a Section.

There can be maximum of one HeaderFooter

of each HeaderFooterType per Section.

HeaderFooter objects can occur in any order in the collection.


Property Getters/Setters Summary
intgetCount()→ inherited from NodeCollection
           Gets the number of nodes in the collection.
HeaderFooterget(int index)
           Retrieves a HeaderFooter at the given index.
HeaderFootergetByHeaderFooterType(int headerFooterType)
           Retrieves a HeaderFooter of the specified type.
 
Method Summary
voidadd(Node node)→ inherited from NodeCollection
           Adds a node to the end of the collection.
voidclear()→ inherited from NodeCollection
           Removes all nodes from this collection and from the document.
booleancontains(Node node)→ inherited from NodeCollection
           Determines whether a node is in the collection.
intindexOf(Node node)→ inherited from NodeCollection
           Returns the zero-based index of the specified node.
voidinsert(int index, Node node)→ inherited from NodeCollection
           Inserts a node into the collection at the specified index.
java.util.Iteratoriterator()→ inherited from NodeCollection
           Provides a simple "foreach" style iteration over the collection of nodes.
voidlinkToPrevious(boolean isLinkToPrevious)
           Links or unlinks all headers and footers to the corresponding headers and footers in the previous section.
voidlinkToPrevious(int headerFooterType, boolean isLinkToPrevious)
           Links or unlinks the specified header or footer to the corresponding header or footer in the previous section.
voidremove(Node node)→ inherited from NodeCollection
           Removes the node from the collection and from the document.
voidremoveAt(int index)→ inherited from NodeCollection
           Removes the node at the specified index from the collection and from the document.
Aspose.Words.Node[]toArray()→ inherited from NodeCollection
           Copies all nodes from the collection to a new array of nodes.
 

Property Getters/Setters Detail

getCount

→ inherited from NodeCollection
public int getCount()
Gets the number of nodes in the collection.

get

public HeaderFooter get(int index)
Retrieves a HeaderFooter at the given 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.

getByHeaderFooterType

public HeaderFooter getByHeaderFooterType(int headerFooterType)
Retrieves a HeaderFooter of the specified type. Returns null if the header/footer of the specified type is not found.
Parameters:
headerFooterType - A HeaderFooterType value. A HeaderFooterType value that specifies the type of the header/footer to retrieve.

Method Detail

iterator

→ inherited from NodeCollection
public java.util.Iterator iterator()
Provides a simple "foreach" style iteration over the collection of nodes.
Returns:
Iterator<Node>.

linkToPrevious

public void linkToPrevious(boolean isLinkToPrevious)
                   throws java.lang.Exception
Links or unlinks all headers and footers to the corresponding headers and footers in the previous section.

If any of the headers or footers do not exist, creates them automatically.

Parameters:
isLinkToPrevious - True to link the headers and footers to the previous section; false to unlink them.

linkToPrevious

public void linkToPrevious(int headerFooterType, boolean isLinkToPrevious)
                   throws java.lang.Exception
Links or unlinks the specified header or footer to the corresponding header or footer in the previous section.

If the header or footer of the specified type does not exist, creates it automatically.

Parameters:
headerFooterType - A HeaderFooterType value that specfies the header or footer to link/unlink.
isLinkToPrevious - True to link the header or footer to the previous section; false to unlink.

add

→ inherited from NodeCollection
public void add(Node node)
        throws java.lang.Exception
Adds a node to the end of the collection.

The node is inserted as a child into the node object from which the collection was created.

If the newChild is already in the tree, it is first removed.

If the node being inserted was created from another document, you should use Document.importNode(com.aspose.words.Node, boolean) to import the node to the current document. The imported node can then be inserted into the current document.

The NodeCollection is a "deep" collection.
Parameters:
node - The node to be added to the end of the collection.

insert

→ inherited from NodeCollection
public void insert(int index, Node node)
           throws java.lang.Exception
Inserts a node into the collection at the specified index.

The node is inserted as a child into the node object from which the collection was created.

If the index is equal to or greater than Count, the node is added at the end of the collection.

If the index is negative and its absolute value is greater than Count, the node is added at the end of the collection.

If the newChild is already in the tree, it is first removed.

If the node being inserted was created from another document, you should use Document.importNode(com.aspose.words.Node, boolean) to import the node to the current document. The imported node can then be inserted into the current document.

The NodeCollection is a "deep" collection.
Parameters:
index - The zero-based index of the node. Negative indexes are allowed and indicate access from the back of the list. For example -1 means the last node, -2 means the second before last and so on.
node - The node to insert.

remove

→ inherited from NodeCollection
public void remove(Node node)
           throws java.lang.Exception
Removes the node from the collection and from the document.
Parameters:
node - The node to remove.

removeAt

→ inherited from NodeCollection
public void removeAt(int index)
             throws java.lang.Exception
Removes the node at the specified index from the collection and from the document.
Parameters:
index - The zero-based index of the node. Negative indexes are allowed and indicate access from the back of the list. For example -1 means the last node, -2 means the second before last and so on.

clear

→ inherited from NodeCollection
public void clear()
          throws java.lang.Exception
Removes all nodes from this collection and from the document.

contains

→ inherited from NodeCollection
public boolean contains(Node node)
Determines whether a node is in the collection.

This method performs a linear search; therefore, the average execution time is proportional to Count.

Parameters:
node - The node to locate.
Returns:
True if item is found in the collection; otherwise, false.

indexOf

→ inherited from NodeCollection
public int indexOf(Node node)
Returns the zero-based index of the specified node.

This method performs a linear search; therefore, the average execution time is proportional to Count.

Parameters:
node - The node to locate.
Returns:
The zero-based index of the node within the collection, if found; otherwise, -1.

toArray

→ inherited from NodeCollection
public Aspose.Words.Node[] toArray()
Copies all nodes from the collection to a new array of nodes.

You should not be adding/removing nodes while iterating over a collection of nodes because it invalidates the iterator and requires refreshes for live collections.

To be able to add/remove nodes during iteration, use this method to copy nodes into a fixed-size array and then iterate over the array.

Returns:
An array of nodes.

See Also:
          Wiki - the home page for the Aspose.Words Product Documentation that includes Programmer's Guide, Knowledge Base and other articles.
          Aspose.Words Support Forum - our preferred method of support.
          Aspose.Words Team - contact Aspose.Words Team.


ASPOSE home