* the header to be set.
*/
public void setHeader(String header) {
if (header != null) {
String[] headerContents = header.split("\n");
TextListHeaderElement listHeaderElement = null;
Node firstNode = listElement.getFirstChild();
if (firstNode instanceof TextListHeaderElement) {
listHeaderElement = (TextListHeaderElement) firstNode;
Node pElement = listHeaderElement.getFirstChild();
while (pElement != null) {
firstNode.removeChild(pElement);
pElement = pElement.getNextSibling();
}
} else {
listHeaderElement = ((OdfFileDom) listElement.getOwnerDocument())
.newOdfElement(TextListHeaderElement.class);
listElement.insertBefore(listHeaderElement, firstNode);
}
for (String headerContent : headerContents) {
TextPElement pElement = listHeaderElement.newTextPElement();
pElement.setTextContent(headerContent);
}
}
}