政企WPS

This commit is contained in:
zhangqinbin
2023-12-21 17:36:28 +08:00
parent 5deb7dc484
commit 09c8cd8ce6

View File

@ -293,15 +293,15 @@ public class WpsController {
String fileName = fileIdName;
String text = " ";
byte buf[] = text.getBytes();
// try {
//// URL crt = test.class.getClassLoader().getResource("text.doc");
//// File file = new File(crt.getPath());
//// BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
//// buf = IOUtils.toByteArray(bis);
// }catch (Exception e){
// log.error("读取异常",e);
// CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("模板文件读取异常",true);
// }
try {
File tempFile = File.createTempFile("tempDoc", ".doc");
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(tempFile));
buf = IOUtils.toByteArray(bis);
tempFile.deleteOnExit();
}catch (Exception e){
log.error("读取异常",e);
CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("模板文件读取异常",true);
}
String fileLength = String.valueOf(buf.length);