diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 8b8116690..f7a5c4b42 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -838,7 +838,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { String filepath = fmUploadDir; String filename = UUID.randomUUID() + ".docx"; String exportFileName = "结算单.docx"; - WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,null); + WordUtil.exportWord(templatePath, filepath, filename, exportFileName, result, request, response,rowsParams); } diff --git a/mallinkService/src/main/java/com/iformall/utils/WordUtil.java b/mallinkService/src/main/java/com/iformall/utils/WordUtil.java index d01e3e0ad..257c00e5f 100644 --- a/mallinkService/src/main/java/com/iformall/utils/WordUtil.java +++ b/mallinkService/src/main/java/com/iformall/utils/WordUtil.java @@ -59,7 +59,7 @@ public class WordUtil { XWPFDocument doc = WordExportUtil.exportWord07(templatePath, params); if(!CollectionUtils.isEmpty(rowsParams)) - insertValueToTable(doc,rowsParams,1); + insertValueToTable(doc,rowsParams,0); String tmpPath = temDir + fileName; FileOutputStream fos = new FileOutputStream(tmpPath); @@ -100,16 +100,13 @@ public class WordUtil { */ public static void insertValueToTable(XWPFDocument xwpfDocument, List> params, int tableIndex) throws Exception { List tableList = xwpfDocument.getTables(); - if(tableList.size()<=tableIndex){ - throw new Exception("tableIndex对应的表格不存在"); - } XWPFTable table = tableList.get(tableIndex); List rows = table.getRows(); if(rows.size()<2){ throw new Exception("tableIndex对应表格应该为2行"); } //模板的那一行 - XWPFTableRow tmpRow = rows.get(3); + XWPFTableRow tmpRow = rows.get(2); List tmpCells = null; List cells = null; XWPFTableCell tmpCell = null; diff --git a/mallinkService/src/main/resources/contract-word-template/settle.docx b/mallinkService/src/main/resources/contract-word-template/settle.docx index 47a1568e5..c87fbad5d 100644 Binary files a/mallinkService/src/main/resources/contract-word-template/settle.docx and b/mallinkService/src/main/resources/contract-word-template/settle.docx differ