Browse Source

csv当作excel预览

pull/29/MERGE
陈精华 2 years ago
parent
commit
489bdfbc01
No known key found for this signature in database
GPG Key ID: 30BDC970902B755D
  1. 2
      server/src/main/java/cn/keking/model/FileType.java
  2. 2
      server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java

2
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"};

2
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;

Loading…
Cancel
Save