|
|
|
@@ -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<Map<String,String>> params, int tableIndex) throws Exception { |
|
|
|
List<XWPFTable> tableList = xwpfDocument.getTables(); |
|
|
|
if(tableList.size()<=tableIndex){ |
|
|
|
throw new Exception("tableIndex对应的表格不存在"); |
|
|
|
} |
|
|
|
XWPFTable table = tableList.get(tableIndex); |
|
|
|
List<XWPFTableRow> rows = table.getRows(); |
|
|
|
if(rows.size()<2){ |
|
|
|
throw new Exception("tableIndex对应表格应该为2行"); |
|
|
|
} |
|
|
|
//模板的那一行 |
|
|
|
XWPFTableRow tmpRow = rows.get(3); |
|
|
|
XWPFTableRow tmpRow = rows.get(2); |
|
|
|
List<XWPFTableCell> tmpCells = null; |
|
|
|
List<XWPFTableCell> cells = null; |
|
|
|
XWPFTableCell tmpCell = null; |
|
|
|
|