How can I assign to word that the horizontal sheet creates me ?, by default I create it vertical
XWPFDocument document = new XWPFDocument();
def doc = document.getDocument();
def body = doc.getBody();
def section = body.getSectPr();
if(!section.isSetPgSz()) {
section.addNewPgSz();
}
def pageSize = section.getPgSz();
pageSize.setOrient(STPageOrientation.LANDSCAPE);
But I have this error:
Cannot invoke method addNewPgSz() on null object