/** ==========文档创建====开始======== */ CustomXWPFDocument docx = new CustomXWPFDocument(); // 设置页面大小间距 CTDocument1 document = docx.getDocument(); CTBody body = document.getBody(); if (!body.isSetSectPr()) { body.addNewSectPr(); } CTSectPr section = body.getSectPr(); if(!section.isSetPgSz()) { section.addNewPgSz(); } // 设置页面大小 当前A4大小 CTPageSz pageSize = section.getPgSz(); pageSize.setW(BigInteger.valueOf(11907)); pageSize.setH(BigInteger.valueOf(16840)); pageSize.setOrient(STPageOrientation.PORTRAIT); WordUtil.setMargins(docx, 1620L, 1645L, 1440L, 1440L);// 设置 页边间距
POI导出word设置页面大小及边距
最新推荐文章于 2024-06-05 17:45:00 发布