/** * This is an alias to 'getBody().addEle' */ @Override public void addEle(String str) { this.getBody().addEle(str); }
@Override public IFooter getFooter() {//forward it to the body return this.getBody().getFooter(); } @Override
@Override public IHeader getHeader() { return this.getBody().getHeader(); //forward it to the body }
@Override public String getContent() { if(hasBeenCalledBefore ){ return txt.toString(); }else{ hasBeenCalledBefore = true; } txt.append(this.getUri()); txt.append(getDocumentHead()); txt.append(this.getBody().getContent()); txt.append("\n</w:wordDocument>"); String finalString = setUpPageOrientation(txt.toString()); return finalString; }
@Override public String getContent() { if(hasBeenCalledBefore ){ return txt.toString(); }else{ hasBeenCalledBefore = true; } txt.append(this.getUri()); txt.append(getDocumentHead()); txt.append(this.getBody().getContent()); txt.append("\n</w:wordDocument>"); String finalString = setUpPageOrientation(txt.toString()); return finalString; }
@Test public void testGetHeader() { IDocument myDoc = new Document2004(); assertTrue(myDoc.getBody().getContent().contains("<w:body>")); assertTrue(myDoc.getBody().getContent().contains("</w:body>")); }
/** * This is an alias to 'getBody().addEle' */ @Override public void addEle(IElement e) { this.getBody().addEle(e); }
@Override public IFooter getFooter() {//forward it to the body return this.getBody().getFooter(); } @Override
@Override public IHeader getHeader() { return this.getBody().getHeader(); //forward it to the body }
@Test public void testAddElementAliasString() { IDocument myDoc = new Document2004(); myDoc.addEle(Heading1.with("heading1").create().getContent()); assertTrue(myDoc.getBody().getContent().contains("<w:body>")); assertTrue(myDoc.getBody().getContent().contains("<w:t>heading1</w:t>")); assertTrue(myDoc.getBody().getContent().contains("</w:body>")); }
/** * This is an alias to 'getBody().addEle' */ @Override public void addEle(String str) { this.getBody().addEle(str); }
@Test public void testBody() { IDocument myDoc = new Document2004(); assertEquals(1, TestUtils.regexCount(myDoc.getBody().getContent(), "<w:body>")); assertEquals(1, TestUtils.regexCount(myDoc.getBody().getContent(), "</w:body>")); }
/** * This is an alias to 'getBody().addEle' */ @Override public void addEle(IElement e) { this.getBody().addEle(e); }