HeaderFooterCollection

Inheritance: java.lang.Object, com.aspose.words.NodeCollection

public class HeaderFooterCollection extends NodeCollection

Provides typed access to HeaderFooter nodes of a Section.

To learn more, visit the Working with Headers and Footers documentation article.

There can be maximum of one HeaderFooter

of each HeaderFooterType per Section.

HeaderFooter objects can occur in any order in the collection.

Methods

Method Description
add(Node node) Adds a node to the end of the collection.
clear() Removes all nodes from this collection and from the document.
contains(Node node) Determines whether a node is in the collection.
equals(Object arg0)
get(int index) Retrieves a HeaderFooter at the given index.
getByHeaderFooterType(int headerFooterType)
getClass()
getContainer()
getCount() Gets the number of nodes in the collection.
getCurrentNode()
getNextMatchingNode(Node curNode)
hashCode()
indexOf(Node node) Returns the zero-based index of the specified node.
insert(int index, Node node) Inserts a node into the collection at the specified index.
iterator() Provides a simple “foreach” style iteration over the collection of nodes.
linkToPrevious(boolean isLinkToPrevious) Links or unlinks all headers and footers to the corresponding headers and footers in the previous section.
linkToPrevious(int headerFooterType, boolean isLinkToPrevious)
notify()
notifyAll()
remove(Node node) Removes the node from the collection and from the document.
removeAt(int index) Removes the node at the specified index from the collection and from the document.
toArray() Copies all HeaderFoorter s from the collection to a new array of HeaderFoorter s.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

add(Node node)

public void add(Node node)

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 node being inserted was created from another document, you should use M:Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean,Aspose.Words.ImportFormatMode) to import the node to the current document. The imported node can then be inserted into the current document.

Parameters:

Parameter Type Description
node Node The node to be added to the end of the collection.

clear()

public void clear()

Removes all nodes from this collection and from the document.

contains(Node node)

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 getCount().

Parameters:

Parameter Type Description
node Node The node to locate.

Returns: boolean - { true if item is found in the collection; otherwise, false .

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

Parameter Type Description
arg0 java.lang.Object

Returns: boolean

get(int index)

public Node 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:

Parameter Type Description
index int An index into the collection.

Returns: Node - The corresponding HeaderFooter value.

getByHeaderFooterType(int headerFooterType)

public HeaderFooter getByHeaderFooterType(int headerFooterType)

Parameters:

Parameter Type Description
headerFooterType int

Returns: HeaderFooter

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getContainer()

public CompositeNode getContainer()

Returns: CompositeNode

getCount()

public int getCount()

Gets the number of nodes in the collection.

Returns: int - The number of nodes in the collection.

getCurrentNode()

public Node getCurrentNode()

Returns: Node

getNextMatchingNode(Node curNode)

public Node getNextMatchingNode(Node curNode)

Parameters:

Parameter Type Description
curNode Node

Returns: Node

hashCode()

public native int hashCode()

Returns: int

indexOf(Node node)

public int indexOf(Node node)

Returns the zero-based index of the specified node.

Parameters:

Parameter Type Description
node Node The node to locate.

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

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

insert(int index, Node node)

public void insert(int index, Node node)

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 getCount(), the node is added at the end of the collection.

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

If the node being inserted was created from another document, you should use M:Aspose.Words.DocumentBase.ImportNode(Aspose.Words.Node,System.Boolean,Aspose.Words.ImportFormatMode) to import the node to the current document. The imported node can then be inserted into the current document.

Parameters:

Parameter Type Description
index int 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 Node The node to insert.

iterator()

public Iterator iterator()

Provides a simple “foreach” style iteration over the collection of nodes.

Returns: java.util.Iterator - An Iterator.

linkToPrevious(boolean isLinkToPrevious)

public void linkToPrevious(boolean isLinkToPrevious)

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:

Parameter Type Description
isLinkToPrevious boolean { true to link the headers and footers to the previous section; false to unlink them.

linkToPrevious(int headerFooterType, boolean isLinkToPrevious)

public void linkToPrevious(int headerFooterType, boolean isLinkToPrevious)

Parameters:

Parameter Type Description
headerFooterType int
isLinkToPrevious boolean

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

remove(Node node)

public void remove(Node node)

Removes the node from the collection and from the document.

Parameters:

Parameter Type Description
node Node The node to remove.

removeAt(int index)

public void removeAt(int index)

Removes the node at the specified index from the collection and from the document.

Parameters:

Parameter Type Description
index int 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.

toArray()

public HeaderFooter[] toArray()

Copies all HeaderFoorter s from the collection to a new array of HeaderFoorter s.

Returns: com.aspose.words.HeaderFooter[] - An array of HeaderFoorter s.

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

Parameter Type Description
arg0 long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

Parameter Type Description
arg0 long
arg1 int