excel打印边距设置

   
    HSSFSheet sheet = workbook.createSheet(title);
        HSSFPrintSetup ps = sheet.getPrintSetup();
        ps.setLandscape(false); //打印方向,true:横向,false:纵向
        ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE); //纸张
        sheet.setPrintGridlines(false);
        sheet.setMargin(HSSFSheet.TopMargin,( double ) 0.3); // 上边距
        sheet.setMargin(HSSFSheet.BottomMargin,( double ) 0.3); // 下边距
        sheet.setMargin(HSSFSheet.LeftMargin, (double)0.1); //页边距(左)
        sheet.setMargin(HSSFSheet.RightMargin, (double)0.1);//页边距(右)
        sheet.setHorizontallyCenter(true); //设置打印页面为水平居中

你可能感兴趣的:(Excel)