From ef4f27ddab2f399d3c75f3dc921a84f0075a8adc Mon Sep 17 00:00:00 2001 From: caihaohan Date: Sun, 21 Apr 2024 00:00:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=E7=BA=BF=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E6=9C=AC=E6=96=B9=E5=90=91=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E8=AE=BE=E4=B8=BA=E7=BA=B5=E5=90=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OnlyOfficeController.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java b/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java index bcef934b..b1ee29c5 100644 --- a/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java +++ b/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java @@ -370,7 +370,19 @@ public class OnlyOfficeController { // 加载文档 Document doc = new Document(filePath + path); - doc.getSections().get(0).getPageSetup().setPageNumberStyle(PageNumberStyle.Roman_Upper); + int i = 0; + try { + doc.getSections().get(0).getPageSetup().setPageNumberStyle(PageNumberStyle.Roman_Upper); + for (; i < Integer.MAX_VALUE; i++) { + if (i == 1) { + doc.getSections().get(1).getPageSetup().setOrientation(PageOrientation.Portrait);//纵向 + } + doc.getSections().get(i).getPageSetup().setOrientation(PageOrientation.Portrait);//纵向 + } + } catch (Exception e) { + log.info("设置纵向页面,循环次数为:{}", i + 1); + } + doc.getSections().get(1).getPageSetup().setPageNumberStyle(PageNumberStyle.Roman_Upper); String downloadDocxFileTempUrl = filePath + "/downloadDocxFileTemp";