word.w2004.Header2004 Maven / Gradle / Ivy
The newest version!
package word.w2004;
import word.api.interfaces.IElement;
import word.api.interfaces.IHeader;
public class Header2004 implements IHeader{
StringBuilder txt = new StringBuilder("");
private boolean hasBeenCalledBefore = false; // if getContent has already been called, I cached the result for future invocations
private boolean hideHeaderAndFooterFirstPage = false;
public void addEle(IElement e) {
this.txt.append("\n" + e.getContent());
}
public void addEle(String str) {
this.txt.append("\n" + str);
}
public String getContent() {
if("".equals(txt.toString())){
return "";
}
if(hasBeenCalledBefore ){
return txt.toString();
}else{
hasBeenCalledBefore = true;
}
txt.insert(0, HEADER_TOP);
txt.append(HEADER_BOTTON);
return txt.toString();
}
public String getHideHeaderAndFooterFirstPageXml() {
return HIDE_HEADER__FOOTER_FIRST_PAGE;
}
public boolean getHideHeaderAndFooterFirstPage() {
return this.hideHeaderAndFooterFirstPage ;
}
public void setHideHeaderAndFooterFirstPage(boolean value) {
this.hideHeaderAndFooterFirstPage = value;
}
private static final String HEADER_TOP = "\n\n ";
private static final String HEADER_BOTTON = "\n ";
public static final String HIDE_HEADER__FOOTER_FIRST_PAGE =
"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
+"\n "
;
}