How to set page orientation landscape and portrait in same word document using NPOI C#
private void changeOrientation(XWPFDocument document, String orientation){ CTDocument1 doc = document.getDocument(); CTBody body = doc.addNewBody(); body.addNewSectPr(); CTSectPr section = body.getSectPr(); if(!section.isSetPgSz()) { section.addNewPgSz(); } 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)); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)