/** * Return the {@link CTSectPr} object that corresponds with the * last section in this document. * * @return {@link CTSectPr} object */ private CTSectPr getSection() { CTBody ctBody = getDocument().getBody(); return (ctBody.isSetSectPr() ? ctBody.getSectPr() : ctBody.addNewSectPr()); }
sectPr = ctBody.isSetSectPr() ? ctBody.getSectPr() : ctBody.addNewSectPr();
XWPFDocument document = new XWPFDocument(); try{ CTSectPr sectpr = document.getDocument().getBody().addNewSectPr(); if(!sectpr.isSetPgSz()) { sectpr.addNewPgSz();
CTBody body = doc.getDocument().getBody(); CTSectPr sectPr = body.isSetSectPr()? body.getSectPr() : body.addNewSectPr();
private void changeOrientation(XWPFDocument document, String orientation){ CTDocument1 doc = document.getDocument(); CTBody body = doc.getBody(); CTSectPr section = body.addNewSectPr(); XWPFParagraph para = document.createParagraph(); CTP ctp = para.getCTP(); CTPPr br = ctp.addNewPPr(); br.setSectPr(section); CTPageSz pageSize = section.getPgSz(); if(orientation.equals("landscape")){ pageSize.setOrient(STPageOrientation.LANDSCAPE); pageSize.setW(BigInteger.valueOf(842 * 20)); pageSize.setH(BigInteger.valueOf(595 * 20)); } else{ pageSize.setOrient(STPageOrientation.PORTRAIT); pageSize.setH(BigInteger.valueOf(842 * 20)); pageSize.setW(BigInteger.valueOf(595 * 20)); } }
/** * Return the {@link CTSectPr} object that corresponds with the * last section in this document. * * @return {@link CTSectPr} object */ private CTSectPr getSection() { CTBody ctBody = getDocument().getBody(); return (ctBody.isSetSectPr() ? ctBody.getSectPr() : ctBody.addNewSectPr()); }
XWPFDocument document = new XWPFDocument(); try{ CTSectPr sectpr = document.getDocument().getBody().addNewSectPr(); if(!sectpr.isSetPgSz()) { sectpr.addNewPgSz();
sectPr = ctBody.isSetSectPr() ? ctBody.getSectPr() : ctBody.addNewSectPr();