Explorar o código

解决导出为只含数据的Excel存在空白表格的问题

sunyj %!s(int64=9) %!d(string=hai) anos
pai
achega
6ad6bb33ef

+ 1 - 2
src/main/java/com/uas/report/controller/UploadController.java

@@ -46,7 +46,6 @@ public class UploadController {
 			return message;
 		}
 
-		logger.info("开始上传...");
 		String fileName = file.getOriginalFilename();
 		StringBuilder stringBuilder = new StringBuilder(ReportConstants.REPORT_DIR).append(userName)
 				.append(File.separator);
@@ -66,7 +65,7 @@ public class UploadController {
 		}
 		try {
 			file.transferTo(targetFile);
-			message = "成功上传文件 " + fileName + " 至 " + targetFile.getCanonicalPath();
+			message = "成功上传文件至:" + targetFile.getCanonicalPath();
 			logger.info(message);
 			return message;
 		} catch (IllegalStateException | IOException e) {

+ 2 - 0
src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -363,9 +363,11 @@ public class PrintServiceImpl implements PrintService {
 		jasperDesign.setBackground(null);
 		// 忽略分页,以使列名只打印一次
 		jasperDesign.setIgnorePagination(true);
+		// 设置页边距,页宽,以免存在空白表格
 		jasperDesign.setTopMargin(0);
 		jasperDesign.setLeftMargin(0);
 		jasperDesign.setBottomMargin(0);
 		jasperDesign.setRightMargin(0);
+		jasperDesign.setPageWidth(555);
 	}
 }