From 7f71d6b2cf8c277e55ca1bc82a3b8dc64c4302a6 Mon Sep 17 00:00:00 2001 From: cjw Date: Fri, 31 May 2024 15:14:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Exls=EF=BC=8Cppt=E7=9A=84?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/dromara/file/service/impl/FileService.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/ruoyi-file/src/main/java/org/dromara/file/service/impl/FileService.java b/ruoyi-modules/ruoyi-file/src/main/java/org/dromara/file/service/impl/FileService.java index b356c69..4bd336e 100644 --- a/ruoyi-modules/ruoyi-file/src/main/java/org/dromara/file/service/impl/FileService.java +++ b/ruoyi-modules/ruoyi-file/src/main/java/org/dromara/file/service/impl/FileService.java @@ -1,7 +1,8 @@ package org.dromara.file.service.impl; +import com.aspose.cells.Workbook; +import com.aspose.slides.Presentation; import com.aspose.words.Document; -import com.aspose.words.SaveFormat; import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; import org.dromara.common.oss.core.OssClient; @@ -48,7 +49,15 @@ public class FileService implements IFileService { // 前端word预览仅支持.docx,将.doc转换为.docx if ((".doc").equals(sysOss.getFileSuffix())) { Document doc = new Document(is); - doc.save(os, SaveFormat.DOCX); + doc.save(os, com.aspose.words.SaveFormat.DOCX); + } + if ((".xls").equals(sysOss.getFileSuffix())) { + Workbook xls = new Workbook(is); + xls.save(os, com.aspose.cells.SaveFormat.XLSX); + } + if ((".ppt").equals(sysOss.getFileSuffix())) { + Presentation xls = new Presentation(is); + xls.save(os, com.aspose.slides.SaveFormat.Pptx); } int len = 0; while ((len = is.read(byteData)) != -1) {