} else {
headerEle.setStyleDisplayAttribute(false);
}
NodeList nodeList = headerEle.getElementsByTagName(TextPElement.ELEMENT_NAME.getQName());
for (int i = 0; i < nodeList.getLength(); i++) {
TextPElement textEle = (TextPElement) nodeList.item(i);
String stylename = textEle.getStyleName();
OdfFileDom dom = (OdfFileDom) headerEle.getOwnerDocument();
OdfOfficeAutomaticStyles styles = null;
if (dom instanceof OdfContentDom) {
styles = ((OdfContentDom) dom).getAutomaticStyles();
} else if (dom instanceof OdfStylesDom) {
styles = ((OdfStylesDom) dom).getAutomaticStyles();
}
OdfStyle newStyle = styles.newStyle(OdfStyleFamily.Paragraph);
OdfStyle style = styles.getStyle(stylename, OdfStyleFamily.Paragraph);
if (style != null) {
String styleName = newStyle.getStyleNameAttribute();
styles.removeChild(newStyle);
newStyle = (OdfStyle) style.cloneNode(true);
newStyle.setStyleNameAttribute(styleName);
styles.appendChild(newStyle);
}
if (isVisible) {
if (newStyle.hasProperty(StyleTextPropertiesElement.Display)) {
newStyle.removeProperty(StyleTextPropertiesElement.Display);
}
} else {
newStyle.setProperty(StyleTextPropertiesElement.Display, "none");
}
textEle.setStyleName(newStyle.getStyleNameAttribute());
}
}