예제 #1
0
  /**
   * Adds page break to document
   *
   * @param content Document's main part
   * @throws Docx4JException
   */
  private void addPageBreak(MainDocumentPart content) throws Docx4JException {
    Br breakObj = objectFactory.createBr();
    breakObj.setType(STBrType.PAGE);

    P paragraph = objectFactory.createP();
    paragraph.getContent().add(breakObj);
    content.getContents().getBody().getContent().add(paragraph);
  }
예제 #2
0
 public static P createNewPage(MainDocumentPart mdp) {
   ObjectFactory objectFactory = new ObjectFactory();
   org.docx4j.wml.P p = objectFactory.createP();
   org.docx4j.wml.R run = objectFactory.createR();
   Br br = objectFactory.createBr();
   br.setType(STBrType.PAGE);
   run.getContent().add(br);
   p.getContent().add(run);
   mdp.getContent().add(p);
   return p;
 }
 @Override
 protected void newPage() {
   flushNow();
   Br objBr = new Br();
   objBr.setType(STBrType.PAGE);
   P para = createParagraph();
   para.getContent().add(objBr);
   wordMLPackage.getMainDocumentPart().getContent().add(para);
   if (bean.getReportLayout().isHeaderOnEveryPage()) {
     try {
       printHeaderBand();
       newRow = true;
     } catch (QueryException e) {
       e.printStackTrace();
     }
   }
 }