您好,需要设置打印区域,
- for (IWorksheet worksheet : workbook.getWorksheets()) {
- worksheet.getPageSetup().setPrintArea("$A$1:$T$6");
- worksheet.getPageSetup().setCenterHorizontally(true);
- worksheet.getPageSetup().setCenterVertically(true);
- worksheet.save("E:\\download\\Desktop\"+worksheet.getName()+".pdf", pdfSaveOptions);
- }
复制代码 设置后,就可以正常水平垂直居中了
|