Merge remote-tracking branch 'origin/apps_dev' into apps_dev
This commit is contained in:
commit
98ddac1270
Binary file not shown.
@ -546,22 +546,17 @@ public class OutputWordUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 在第一页的末尾插入分页符
|
|
||||||
//section.addParagraph().appendBreak(BreakType.Page_Break);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||||
|
|
||||||
if (suffix.equals("xml")) {
|
if (suffix.equals("xml")) {
|
||||||
// 输出文档路径及名称
|
// 输出文档路径及名称
|
||||||
File sourceFile = new UtilFile(path + fileName);
|
File sourceFile = new UtilFile(path + fileName);
|
||||||
File targetFile = new UtilFile(docPath + fileName);
|
File targetFile = new UtilFile(docPath+ fileName);
|
||||||
try {
|
try {
|
||||||
UtilFile.copyFile(sourceFile, targetFile);
|
UtilFile.copyFile(sourceFile, targetFile);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -571,185 +566,29 @@ public class OutputWordUtil {
|
|||||||
|
|
||||||
//创建实例,加载xml测试文档
|
//创建实例,加载xml测试文档
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
doc.loadFromFile(docPath + fileName);
|
doc.loadFromFile(docPath+ fileName);
|
||||||
|
|
||||||
//保存为xml格式
|
//保存为xml格式
|
||||||
String substring = fileName.substring(0, fileName.lastIndexOf(".xml"));
|
String substring = fileName.substring(0, fileName.lastIndexOf(".xml"));
|
||||||
|
|
||||||
//保存为Word
|
//保存为Word
|
||||||
doc.saveToFile(docPath + substring + ".docx", FileFormat.Docx);//支持.doc
|
doc.saveToFile(docPath +"/xmltodoc/"+ substring + ".doc", FileFormat.Doc);//支持.doc
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (suffix.equals("xml")) {
|
if (suffix.equals("xml")) {
|
||||||
//保存为xml格式
|
//保存为xml格式
|
||||||
String substring = fileName.substring(0, fileName.lastIndexOf(".xml"));
|
String substring = fileName.substring(0, fileName.lastIndexOf(".xml"));
|
||||||
//保存为Word
|
//保存为Word
|
||||||
/*document.insertTextFromFile(docPath + substring + ".docx", FileFormat.Docx_2013);
|
document.insertTextFromFile(docPath+"/xmltodoc/" + substring + ".doc", FileFormat.Doc);
|
||||||
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);*/
|
|
||||||
|
|
||||||
|
|
||||||
Document document1 = new Document(outFile.getPath());
|
|
||||||
Document document2 = new Document(docPath + substring + ".docx");
|
|
||||||
|
|
||||||
// 获取最后第一节
|
|
||||||
Section section = document1.getLastSection();
|
|
||||||
// 获取该节第三段
|
|
||||||
Paragraph paragraph = section.getParagraphs().get(3);
|
|
||||||
// 在段落的末尾添加分页符
|
|
||||||
paragraph.appendBreak(BreakType.Page_Break);
|
|
||||||
// 在第二个文档中循环获取所有节
|
|
||||||
for (Object sectionObj : (Iterable) document2.getSections()) {
|
|
||||||
Section sec = (Section) sectionObj;
|
|
||||||
// 在所有节中循环获取所有子对象
|
|
||||||
for (Object docObj : (Iterable) sec.getBody().getChildObjects()) {
|
|
||||||
DocumentObject obj = (DocumentObject) docObj;
|
|
||||||
|
|
||||||
// 获取第一个文档的最后一节
|
|
||||||
Section lastSection = document1.getLastSection();
|
|
||||||
|
|
||||||
// 将所有子对象添加到第一个文档的最后一节中
|
|
||||||
Body body = lastSection.getBody();
|
|
||||||
body.getChildObjects().add(obj.deepClone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//保存结果文档
|
//保存结果文档
|
||||||
document1.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 获取第一个节的第一个表格
|
|
||||||
Section threesection = document1.getSections().get(1);
|
|
||||||
Table table3 = threesection.getTables().get(2);
|
|
||||||
//遍历表格单元格
|
|
||||||
for (int i = 0;i< table3.getRows().getCount();i++) {
|
|
||||||
TableRow rows = table3.getRows().get(i);
|
|
||||||
for (int j = 0; j< rows.getCells().getCount(); j++){
|
|
||||||
for (int z= 0; z < rows.getCells().get(j).getParagraphs().getCount();z++){
|
|
||||||
Paragraph p = rows.getCells().get(j).getParagraphs().get(z);
|
|
||||||
p.getFormat().setLineSpacing(12f);//设置边距为1.0
|
|
||||||
for (int k = 0; k < p.getItems().getCount(); k++) {
|
|
||||||
DocumentObject item = p.getItems().get(k);
|
|
||||||
if (item instanceof TextRange) {
|
|
||||||
TextRange textRange = (TextRange) item;
|
|
||||||
textRange.getCharacterFormat().setFontName("宋体");
|
|
||||||
textRange.getCharacterFormat().setFontSize(10.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 获取第一个节的第一个表格
|
|
||||||
Section fourection = document1.getSections().get(1);
|
|
||||||
|
|
||||||
Table table4 = fourection.getTables().get(3);
|
|
||||||
//遍历表格单元格
|
|
||||||
for (int i = 0;i< table4.getRows().getCount();i++) {
|
|
||||||
TableRow rows = table4.getRows().get(i);
|
|
||||||
for (int j = 0; j< rows.getCells().getCount(); j++){
|
|
||||||
for (int z= 0; z < rows.getCells().get(j).getParagraphs().getCount();z++){
|
|
||||||
Paragraph p = rows.getCells().get(j).getParagraphs().get(z);
|
|
||||||
p.getFormat().setLineSpacing(12f);//设置边距为1.0
|
|
||||||
for (int k = 0; k < p.getItems().getCount(); k++) {
|
|
||||||
DocumentObject item = p.getItems().get(k);
|
|
||||||
if (item instanceof TextRange) {
|
|
||||||
TextRange textRange = (TextRange) item;
|
|
||||||
textRange.getCharacterFormat().setFontName("宋体");
|
|
||||||
textRange.getCharacterFormat().setFontSize(10.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document1.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
|
||||||
|
|
||||||
|
|
||||||
} else if (suffix.equals("doc") || suffix.equals("docx")) {
|
} else if (suffix.equals("doc") || suffix.equals("docx")) {
|
||||||
//document.insertTextFromFile(path + fileName, FileFormat.Doc);
|
document.insertTextFromFile(path + fileName, FileFormat.Docx_2013);
|
||||||
|
|
||||||
|
|
||||||
Document document1 = new Document(outFile.getPath());
|
|
||||||
Document document2 = new Document(path + fileName);
|
|
||||||
|
|
||||||
// 获取最后第一节
|
|
||||||
Section section = document1.getLastSection();
|
|
||||||
// 获取该节第三段
|
|
||||||
Paragraph paragraph = section.getParagraphs().get(3);
|
|
||||||
// 在段落的末尾添加分页符
|
|
||||||
paragraph.appendBreak(BreakType.Page_Break);
|
|
||||||
// 在第二个文档中循环获取所有节
|
|
||||||
for (Object sectionObj : (Iterable) document2.getSections()) {
|
|
||||||
Section sec = (Section) sectionObj;
|
|
||||||
// 在所有节中循环获取所有子对象
|
|
||||||
for (Object docObj : (Iterable) sec.getBody().getChildObjects()) {
|
|
||||||
DocumentObject obj = (DocumentObject) docObj;
|
|
||||||
|
|
||||||
// 获取第一个文档的最后一节
|
|
||||||
Section lastSection = document1.getLastSection();
|
|
||||||
|
|
||||||
// 将所有子对象添加到第一个文档的最后一节中
|
|
||||||
Body body = lastSection.getBody();
|
|
||||||
body.getChildObjects().add(obj.deepClone());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//保存结果文档
|
//保存结果文档
|
||||||
document1.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
document.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||||
|
} else if (suffix.equals("pptx")) {
|
||||||
|
|
||||||
|
|
||||||
// 获取第一个节的第一个表格
|
|
||||||
Section threesection = document1.getSections().get(1);
|
|
||||||
|
|
||||||
if(threesection.getTables().getCount()>3){
|
|
||||||
Table table3 = threesection.getTables().get(2);
|
|
||||||
//遍历表格单元格
|
|
||||||
for (int i = 0;i< table3.getRows().getCount();i++) {
|
|
||||||
TableRow rows = table3.getRows().get(i);
|
|
||||||
for (int j = 0; j< rows.getCells().getCount(); j++){
|
|
||||||
for (int z= 0; z < rows.getCells().get(j).getParagraphs().getCount();z++){
|
|
||||||
Paragraph p = rows.getCells().get(j).getParagraphs().get(z);
|
|
||||||
p.getFormat().setLineSpacing(12f);//设置边距为1.0
|
|
||||||
for (int k = 0; k < p.getItems().getCount(); k++) {
|
|
||||||
DocumentObject item = p.getItems().get(k);
|
|
||||||
if (item instanceof TextRange) {
|
|
||||||
TextRange textRange = (TextRange) item;
|
|
||||||
textRange.getCharacterFormat().setFontName("宋体");
|
|
||||||
textRange.getCharacterFormat().setFontSize(10.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Table table4 = threesection.getTables().get(3);
|
|
||||||
//遍历表格单元格
|
|
||||||
for (int i = 0;i< table4.getRows().getCount();i++) {
|
|
||||||
TableRow rows = table4.getRows().get(i);
|
|
||||||
for (int j = 0; j< rows.getCells().getCount(); j++){
|
|
||||||
for (int z= 0; z < rows.getCells().get(j).getParagraphs().getCount();z++){
|
|
||||||
Paragraph p = rows.getCells().get(j).getParagraphs().get(z);
|
|
||||||
p.getFormat().setLineSpacing(12f);//设置边距为1.0
|
|
||||||
for (int k = 0; k < p.getItems().getCount(); k++) {
|
|
||||||
DocumentObject item = p.getItems().get(k);
|
|
||||||
if (item instanceof TextRange) {
|
|
||||||
TextRange textRange = (TextRange) item;
|
|
||||||
textRange.getCharacterFormat().setFontName("宋体");
|
|
||||||
textRange.getCharacterFormat().setFontSize(10.5f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document1.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}else if (suffix.equals("pptx")) {
|
|
||||||
isPPT = true;
|
isPPT = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -819,6 +658,10 @@ public class OutputWordUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
doc2.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
doc2.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -1299,6 +1142,7 @@ public class OutputWordUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
System.out.println("生成附件路径是=================="+outFile.getPath());
|
||||||
doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
doc.saveToFile(outFile.getPath(), FileFormat.Docx_2013);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@ -745,12 +745,11 @@ public class TaskController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 用户打开阅览界面日志
|
// 用户打开阅览界面日志
|
||||||
//setUserLog(processInstId, me.getUID(), "3");
|
setUserLog(processInstId, me.getUID(), "3",conn);
|
||||||
|
|
||||||
long have_time = System.currentTimeMillis();
|
long have_time = System.currentTimeMillis();
|
||||||
|
|
||||||
System.out.println("com.yili_process_page耗时时间>>>>>>>>>>>>"+(have_time-start_time)/ 1000 + "秒");
|
System.out.println("com.yili_process_page耗时时间>>>>>>>>>>>>"+(have_time-start_time)/ 1000 + "秒");
|
||||||
DBSql.close(conn);
|
|
||||||
// }
|
// }
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -1446,7 +1445,7 @@ public class TaskController {
|
|||||||
}
|
}
|
||||||
System.out.println("插入待阅日志开始========================");
|
System.out.println("插入待阅日志开始========================");
|
||||||
// 用户打开阅览界面日志
|
// 用户打开阅览界面日志
|
||||||
//setUserLog(processInstId, me.getUID(), "3");
|
setUserLog(processInstId, me.getUID(), "3",conn);
|
||||||
System.out.println("插入待阅日志结束========================");
|
System.out.println("插入待阅日志结束========================");
|
||||||
/*
|
/*
|
||||||
* JSONObject jsonObject = new JSONObject(); SimpleDateFormat sdf = new
|
* JSONObject jsonObject = new JSONObject(); SimpleDateFormat sdf = new
|
||||||
@ -1491,7 +1490,6 @@ public class TaskController {
|
|||||||
* DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '" + read_num +
|
* DBSql.update("update BO_EU_PAL_READ_LOG set READNUM = '" + read_num +
|
||||||
* "' where PROCESSID = '" + processInstId + "'"); }
|
* "' where PROCESSID = '" + processInstId + "'"); }
|
||||||
*/
|
*/
|
||||||
DBSql.close(conn);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user