首先是Excel的:
HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("标准目录"); sheet.getPrintSetup().setLandscape(true); //横版
API地址: https://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFPrintSetup.html
然后是PDF的:
//设置页面大小 Rectangle rectPageSize = new Rectangle(PageSize.A4);// 定义A4页面大小 rectPageSize = rectPageSize.rotate(); //横版 Document document = new Document(rectPageSize, 50, 50, 50, 50); //边距
呵呵,不用谢。
|