From 489bdfbc017554c8f51c12d80b908bef335ed0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=B2=BE=E5=8D=8E?= <842761733@qq.com> Date: Tue, 22 Nov 2022 17:38:46 +0800 Subject: [PATCH] =?UTF-8?q?csv=E5=BD=93=E4=BD=9Cexcel=E9=A2=84=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/main/java/cn/keking/model/FileType.java | 2 +- .../main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/cn/keking/model/FileType.java b/server/src/main/java/cn/keking/model/FileType.java index fbeea371..2b4ad17f 100644 --- a/server/src/main/java/cn/keking/model/FileType.java +++ b/server/src/main/java/cn/keking/model/FileType.java @@ -27,7 +27,7 @@ public enum FileType { OFD("ofdFilePreviewImpl"); - private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "xls", "xlsx", "ppt", "pptx"}; + private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "xls", "xlsx", "csv", "ppt", "pptx"}; private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "raw"}; private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"}; private static final String[] TIFF_TYPES = {"tif", "tiff"}; diff --git a/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java b/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java index b7b1cfb3..e878cbe3 100644 --- a/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java +++ b/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java @@ -46,7 +46,7 @@ public class OfficeFilePreviewImpl implements FilePreview { String fileName = fileAttribute.getName(); String filePassword = fileAttribute.getFilePassword(); String userToken = fileAttribute.getUserToken(); - boolean isHtml = suffix.equalsIgnoreCase("xls") || suffix.equalsIgnoreCase("xlsx"); + boolean isHtml = suffix.equalsIgnoreCase("xls") || suffix.equalsIgnoreCase("xlsx") || suffix.equalsIgnoreCase("csv"); String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + (isHtml ? "html" : "pdf"); String cacheFileName = userToken == null ? pdfName : userToken + "_" + pdfName; String outFilePath = FILE_DIR + cacheFileName;