Is there a way to change the page size and layout while creating the Excel document using Apache POI? The default one is A4-vertical, while I need A6-horizontal (landscape).
在使用Apache POI创建Excel文档时,是否有办法更改页面大小和布局?默认的是A4-vertical,而我需要A6-horizontal (landscape)。
I don't think that this question requires code sample, the Excel document is created just as described in the manual:
我不认为这个问题需要代码示例,Excel文档是按照手册中描述的那样创建的:
Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("new sheet");
1 个解决方案
#1
19
sheet.getPrintSetup().setLandscape(true);
sheet.getPrintSetup().setPaperSize(HSSFPrintSetup.A5_PAPERSIZE);
HSSFPrinterSetup Javadoc
#1
19
sheet.getPrintSetup().setLandscape(true);
sheet.getPrintSetup().setPaperSize(HSSFPrintSetup.A5_PAPERSIZE);
HSSFPrinterSetup Javadoc