处理异常~
This commit is contained in:
parent
b8ca49f1ed
commit
1e33f1f4fa
@ -168,7 +168,7 @@ public class ReadWordUtil {
|
||||
String fileNewPath = dcContextpdf.getFilePath();
|
||||
String docname = fileName.replace(".docx", ".doc");
|
||||
String docxname = fileName;
|
||||
|
||||
boolean iscreatemap = true;
|
||||
if (fileName.endsWith(".docx")) {
|
||||
docname = dcContextpdf.getFileName().replace(".docx", ".doc");
|
||||
docxname = dcContextpdf.getFileName();
|
||||
@ -191,6 +191,7 @@ public class ReadWordUtil {
|
||||
Document doc = new Document(filepath);
|
||||
doc.save(outputStream, SaveFormat.DOCX);
|
||||
} catch (Exception e) {
|
||||
iscreatemap = false;
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -220,9 +221,11 @@ public class ReadWordUtil {
|
||||
return;
|
||||
}
|
||||
//创建图形
|
||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, docxname);
|
||||
InputStream docxfile = SDK.getDCAPI().read(dcContextpdf1);
|
||||
new CreateMaps().updateMaps(userContext, wsId, docxfile, title);
|
||||
if(iscreatemap){
|
||||
DCContext dcContextpdf1 = new DCContext(userContext, dcProfilepdfdoc, "com.actionsoft.apps.coe.pal.datamigration", groupValue, fileValue, docxname);
|
||||
InputStream docxfile = SDK.getDCAPI().read(dcContextpdf1);
|
||||
new CreateMaps().updateMaps(userContext, wsId, docxfile, title);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -378,9 +381,17 @@ public class ReadWordUtil {
|
||||
//取文件名名称即可
|
||||
Table table = range.getTable(paragraph);
|
||||
Map<String, List<String>> verticalTableText = this.getVerticalTableText(table);
|
||||
List<String> strings = verticalTableText.get("文件");
|
||||
fileMap.put(wordAttribute.getTitle(), strings);
|
||||
fileFieldMap.put(wordAttribute.getTitle(), new WordField<>(strings));
|
||||
List<String> strings = null;
|
||||
if(verticalTableText.get("文件") != null){
|
||||
strings = verticalTableText.get("文件");
|
||||
}
|
||||
if(verticalTableText.get("文件名称") != null){
|
||||
strings = verticalTableText.get("文件名称");
|
||||
}
|
||||
if(strings != null){
|
||||
fileMap.put(wordAttribute.getTitle(), strings);
|
||||
fileFieldMap.put(wordAttribute.getTitle(), new WordField<>(strings));
|
||||
}
|
||||
i += table.numParagraphs();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user