Looly 5 years ago
parent
commit
fd6c023c78
2 changed files with 9 additions and 8 deletions
  1. 1 0
      CHANGELOG.md
  2. 8 8
      hutool-poi/src/main/java/cn/hutool/poi/word/TableUtil.java

+ 1 - 0
CHANGELOG.md

@@ -13,6 +13,7 @@
 ### Bug修复
 * 【json   】     修复append方法导致的JSONConfig传递失效问题(issue#906@Github)
 * 【core   】     修复CollUtil.subtractToList判断错误(pr#915@Github)
+* 【poi    】     修复WordWriter写表格问题(pr#914@Github)
 
 -------------------------------------------------------------------------------------------------------------
 

+ 8 - 8
hutool-poi/src/main/java/cn/hutool/poi/word/TableUtil.java

@@ -1,19 +1,18 @@
 package cn.hutool.poi.word;
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import org.apache.poi.xwpf.usermodel.XWPFDocument;
-import org.apache.poi.xwpf.usermodel.XWPFTable;
-import org.apache.poi.xwpf.usermodel.XWPFTableCell;
-import org.apache.poi.xwpf.usermodel.XWPFTableRow;
-
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.IterUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Assert;
 import cn.hutool.core.map.MapUtil;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFTable;
+import org.apache.poi.xwpf.usermodel.XWPFTableCell;
+import org.apache.poi.xwpf.usermodel.XWPFTableRow;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
 
 /**
  * Word中表格相关工具
@@ -69,6 +68,7 @@ public class TableUtil {
 	public static void writeRow(XWPFTableRow row, Object rowBean, boolean isWriteKeyAsHead) {
 		if (rowBean instanceof Iterable) {
 			writeRow(row, (Iterable<?>) rowBean);
+			return;
 		}
 		
 		Map rowMap = null;