diff --git a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java index 410312f..a118a6b 100644 --- a/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java +++ b/byd-structuredplugins-serve/laws-modules/src/main/java/com/jero/modules/onlyoffice/controller/OnlyOfficeController.java @@ -563,7 +563,26 @@ public class OnlyOfficeController { String attFileId = createTimeLatestOnlineFileLog.getAttFileId(); OSSFile ossFile = ossFileService.getById(attFileId); File file = new File(filePath + ossFile.getUrl()); - FileSystemResource fileResource = new FileSystemResource(file); + + // 加载文档 + Document doc = new Document(filePath + ossFile.getUrl()); + doc.getSections().get(0).getPageSetup().setPageNumberStyle(PageNumberStyle.Roman_Upper); + doc.getSections().get(0).getPageSetup().setOrientation(PageOrientation.Portrait);//纵向 + doc.getSections().get(1).getPageSetup().setOrientation(PageOrientation.Portrait);//纵向 + + String downloadDocxFileTempUrl = filePath + "/downloadDocxFileTemp"; + File downloadDocxFileTempUrlFile = new File(downloadDocxFileTempUrl); + + if (!downloadDocxFileTempUrlFile.exists()) { + downloadDocxFileTempUrlFile.mkdirs(); + } + String newFileName = UUID.randomUUID().toString().replace("-", "") + ".docx"; + String newFileUrl = downloadDocxFileTempUrl + "/" + newFileName; + + //保存文档 + doc.saveToFile(newFileUrl); + + FileSystemResource fileResource = new FileSystemResource(newFileUrl); params2.add("file", fileResource); // 使用HttpEntity对象包装请求体和请求头