|
@@ -3,6 +3,7 @@ package org.springblade.meter.controller;
|
|
|
|
|
|
import cn.hutool.log.StaticLog;
|
|
import cn.hutool.log.StaticLog;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.aspose.cells.PageSetup;
|
|
import com.aspose.cells.SaveFormat;
|
|
import com.aspose.cells.SaveFormat;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -2822,11 +2823,23 @@ public class TaskController extends BladeController {
|
|
sheet.setPrintGridlines(false);
|
|
sheet.setPrintGridlines(false);
|
|
//设置 整个工作表为一页
|
|
//设置 整个工作表为一页
|
|
sheet.setFitToPage(true);
|
|
sheet.setFitToPage(true);
|
|
- sheet.getPrintSetup().setPaperSize(PrintSetup.A4_PAPERSIZE);
|
|
|
|
|
|
+ PrintSetup printSetup = sheet.getPrintSetup();
|
|
|
|
+ /*printSetup.setFitHeight((short) 1);
|
|
|
|
+ printSetup.setFitWidth((short) 1);*/
|
|
|
|
+ // 设置页边距,单位为厘米
|
|
|
|
+ printSetup.setPaperSize(PrintSetup.A4_PAPERSIZE);
|
|
|
|
+
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
|
workbook.write(out);
|
|
workbook.write(out);
|
|
workbook.write(new FileOutputStream(rs.getExcelPath()));
|
|
workbook.write(new FileOutputStream(rs.getExcelPath()));
|
|
com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook(new ByteArrayInputStream(out.toByteArray()));
|
|
com.aspose.cells.Workbook wb = new com.aspose.cells.Workbook(new ByteArrayInputStream(out.toByteArray()));
|
|
|
|
+ PageSetup pageSetup =wb.getWorksheets().get(0).getPageSetup();
|
|
|
|
+ pageSetup.setLeftMargin(0.5); // 左边距
|
|
|
|
+ pageSetup.setRightMargin(0.5); // 右边距
|
|
|
|
+ pageSetup.setTopMargin(1.5); // 上边距
|
|
|
|
+ pageSetup.setBottomMargin(1.5); // 下边距*/
|
|
|
|
+ pageSetup.setCenterHorizontally(true);
|
|
|
|
+ pageSetup.setCenterVertically(true);
|
|
out.reset();
|
|
out.reset();
|
|
wb.save(out, SaveFormat.PDF);
|
|
wb.save(out, SaveFormat.PDF);
|
|
reader = new PdfReader(new ByteArrayInputStream(out.toByteArray()));
|
|
reader = new PdfReader(new ByteArrayInputStream(out.toByteArray()));
|