|
@@ -3,8 +3,8 @@ package com.bowintek.practice.controller;
|
|
import com.alibaba.druid.support.logging.Log;
|
|
import com.alibaba.druid.support.logging.Log;
|
|
import com.aspose.cells.License;
|
|
import com.aspose.cells.License;
|
|
import com.aspose.cells.PdfSaveOptions;
|
|
import com.aspose.cells.PdfSaveOptions;
|
|
-import com.aspose.cells.SaveFormat;
|
|
|
|
import com.aspose.cells.SaveOptions;
|
|
import com.aspose.cells.SaveOptions;
|
|
|
|
+import com.aspose.words.SaveFormat;
|
|
import com.bowintek.practice.AppConfig;
|
|
import com.bowintek.practice.AppConfig;
|
|
import com.bowintek.practice.filter.exception.BaseResponse;
|
|
import com.bowintek.practice.filter.exception.BaseResponse;
|
|
import com.bowintek.practice.filter.exception.RespGenerstor;
|
|
import com.bowintek.practice.filter.exception.RespGenerstor;
|
|
@@ -165,7 +165,34 @@ public class WellInfoController {
|
|
os.close();
|
|
os.close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ private byte[] doc2Docx(byte[] bytes) {
|
|
|
|
+ long old = System.currentTimeMillis();
|
|
|
|
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
|
|
+ try {
|
|
|
|
+ com.aspose.words.License aposeLic = new com.aspose.words.License();
|
|
|
|
+ InputStream license = ClassLoader.getSystemClassLoader().getResourceAsStream("license.xml");
|
|
|
|
+ aposeLic.setLicense(license);
|
|
|
|
+
|
|
|
|
+ com.aspose.words.Document wb = new com.aspose.words.Document(new ByteArrayInputStream(bytes));
|
|
|
|
|
|
|
|
+ wb.save(outputStream, SaveFormat.DOCX);
|
|
|
|
+ bytes = outputStream.toByteArray();
|
|
|
|
+ outputStream.flush();
|
|
|
|
+ long now = System.currentTimeMillis();
|
|
|
|
+ log.info("共耗时:{}", ((now - old) / 1000.0));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ if (outputStream != null) {
|
|
|
|
+ try {
|
|
|
|
+ outputStream.close();
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } ;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return bytes;
|
|
|
|
+ }
|
|
private byte[] xls2pdf(byte[] bytes) {
|
|
private byte[] xls2pdf(byte[] bytes) {
|
|
long old = System.currentTimeMillis();
|
|
long old = System.currentTimeMillis();
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
|
@@ -426,7 +453,7 @@ public class WellInfoController {
|
|
newCell.setCellStyle(newCellStyle);
|
|
newCell.setCellStyle(newCellStyle);
|
|
}
|
|
}
|
|
|
|
|
|
- private byte[] doc2Docx(byte[] bytes) throws IOException {
|
|
|
|
|
|
+ /* private byte[] doc2Docx(byte[] bytes) throws IOException {
|
|
try {
|
|
try {
|
|
// 将doc文件的内容读取到XWPFDocument对象中
|
|
// 将doc文件的内容读取到XWPFDocument对象中
|
|
InputStream fis = new ByteArrayInputStream(bytes);
|
|
InputStream fis = new ByteArrayInputStream(bytes);
|
|
@@ -451,5 +478,5 @@ public class WellInfoController {
|
|
log.info("doc2Docx文件转换失败:" + ex.getMessage());
|
|
log.info("doc2Docx文件转换失败:" + ex.getMessage());
|
|
}
|
|
}
|
|
return bytes;
|
|
return bytes;
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
}
|
|
}
|