新增xls,ppt的文件预览
This commit is contained in:
parent
26bce15c72
commit
7f71d6b2cf
|
@ -1,7 +1,8 @@
|
||||||
package org.dromara.file.service.impl;
|
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.Document;
|
||||||
import com.aspose.words.SaveFormat;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.oss.core.OssClient;
|
import org.dromara.common.oss.core.OssClient;
|
||||||
|
@ -48,7 +49,15 @@ public class FileService implements IFileService {
|
||||||
// 前端word预览仅支持.docx,将.doc转换为.docx
|
// 前端word预览仅支持.docx,将.doc转换为.docx
|
||||||
if ((".doc").equals(sysOss.getFileSuffix())) {
|
if ((".doc").equals(sysOss.getFileSuffix())) {
|
||||||
Document doc = new Document(is);
|
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;
|
int len = 0;
|
||||||
while ((len = is.read(byteData)) != -1) {
|
while ((len = is.read(byteData)) != -1) {
|
||||||
|
|
Loading…
Reference in New Issue