Detect needed print orientation with Apache POI

后端 未结 2 1002
野性不改
野性不改 2021-02-20 13:21

I\'m using Apache POI to create xls spreadsheets. Is there a way to detect if the data fits in portrait mode or if I have to set the sheet to landscape mode? I know how to set t

2条回答
  •  广开言路
    2021-02-20 14:00

       HSSFPrintSetup printSetup = sheet.getPrintSetup();
        sheet.getPrintSetup().setFitWidth((short) 1);
        sheet.getPrintSetup().setFitHeight((short) 0);
        sheet.setAutobreaks(true);
        printSetup .setLandscape(true);
    
       HSSFFooter footer = wygSheet.getFooter();
        footer.setCenter("Page " + HSSFFooter.page() + " of "+ HSSFFooter.numPages());
    

提交回复
热议问题