private List> createListTextRenderDataForJlsb (Map ywXunJian,Map data, Class modelClass ){
    List> listMap = new ArrayList();
    if(modelClass == SmLiuliangjiLx.class) {
    if (ywXunJian.get(“lljLxCd”) == null || data.get(“lljLx”) == null) {
    return null;
    }
    List list = (List) data.get(“lljLx”);
    for (int i = 0; i < list.size(); i++) {
    Map map = new HashMap();
    SmLiuliangjiLx item = list.get(i);
    if(item.getLxCd().equals(ywXunJian.get(“lljLxCd”))){
    map.put(“lxCd”,ExportWordUtil.createCheckBoxTextRenderData(1));
    }else{
    map.put(“lxCd”,ExportWordUtil.createCheckBoxTextRenderData(0));
    }
    map.put(“lxNm”,Texts.of(item.getLxNm() + ((i + 1) % 3 == 0 && i != list.size() - 1 ? “\n” : “ “) ).fontFamily(“仿宋”).create());
    listMap.add(map);
    }
    }
    else if(modelClass == SmLiusuyiLx.class) {
    if (ywXunJian.get(“lsyLxCd”) == null || data.get(“lsyLx”) == null) {
    return null;
    }
    List list = (List) data.get(“lsyLx”);
    for (int i = 0; i < list.size(); i++) {
    Map map = new HashMap();
    SmLiusuyiLx item = list.get(i);
    if(item.getLxCd().equals(ywXunJian.get(“lsyLxCd”))){
    map.put(“lxCd”,ExportWordUtil.createCheckBoxTextRenderData(1));
    }else{
    map.put(“lxCd”,ExportWordUtil.createCheckBoxTextRenderData(0));
    }
    map.put(“lxNm”,Texts.of(item.getLxNm() + ((i + 1) % 3 == 0 && i != list.size() - 1 ? “\n” : “ “) ).fontFamily(“仿宋”).create());
    listMap.add(map);
    }

    1. }<br /> else if(modelClass == SmShuiweijiLx.class) {<br /> if (ywXunJian.get("swjLxCd") == null || data.get("swjLx") == null) {<br /> return null;<br /> }<br /> List<SmShuiweijiLx> list = (List<SmShuiweijiLx>) data.get("swjLx");<br /> for (int i = 0; i < list.size(); i++) {<br /> Map<String, Object> map = new HashMap();<br /> SmShuiweijiLx item = list.get(i);<br /> if(item.getLxCd().equals(ywXunJian.get("swjLxCd"))){<br /> map.put("lxCd",ExportWordUtil.createCheckBoxTextRenderData(1));<br /> }else{<br /> map.put("lxCd",ExportWordUtil.createCheckBoxTextRenderData(0));<br /> }<br /> map.put("lxNm",Texts.of(item.getLxNm() + ((i + 1) % 4 == 0 && i != list.size() - 1 ? "\n" : " ") ).fontFamily("仿宋").create());<br /> listMap.add(map);<br /> }<br /> }<br /> return listMap;<br /> }

    ===============list转字符串====================================
    public static String getContent(LinkedHashMap map,List list){
    StringBuilder stringBuilder = new StringBuilder();
    //设置表头
    for (Map.Entry entry : map.entrySet()) {
    stringBuilder.append(entry.getKey().toString());
    stringBuilder.append(“,”);
    }
    stringBuilder.append(“\n\t”);
    // 拼装excel内容
    T t = null;
    for (int i = 0; i < list.size(); i++) {
    t = (T)list.get(i);
    // 创建单元格,并设置值
    int j=0;
    for (Map.Entry entry : map.entrySet()) {
    int pos = j++;
    try {
    if (!entry.getValue().toString().contains(“.”)) {
    if(t.getClass().getName().equals(“java.util.HashMap”)){
    Object obj;
    obj = ((Map)t).get(entry.getValue().toString());
    if(obj.toString().equals(“0E-10”)) {
    stringBuilder.append(“0”);
    stringBuilder.append(“,”);
    }
    else {
    stringBuilder.append(obj == null ? “” :obj);
    stringBuilder.append(“,”);
    }
    } else {
    Field field = t.getClass().getDeclaredField(entry.getValue().toString());
    //设置对象的访问权限,保证对private的属性的访问
    field.setAccessible(true);
    stringBuilder.append(field.get(t) == null ? “” : field.get(t));
    stringBuilder.append(“,”);
    }
    } else {
    String[] arr = entry.getValue().toString().split(“\.”);
    Object tmpObject = t;

    1. for (int k = 0; k < arr.length; k++) {<br /> if(t.getClass().getName().equals("java.util.HashMap")){<br /> if (k == arr.length - 1) {<br /> Object obj = ((Map)t).get(arr[k]);<br /> if(obj.toString().equals("0E-10")) {<br /> stringBuilder.append("0");<br /> stringBuilder.append(",");<br /> }<br /> else {<br /> stringBuilder.append(obj == null ? "" :obj);<br /> stringBuilder.append(",");<br /> }<br /> break;<br /> }<br /> } else {<br /> if (k == arr.length - 1) {<br /> Field tmpField = tmpObject.getClass().getDeclaredField(arr[k]);<br /> //设置对象的访问权限,保证对private的属性的访问<br /> tmpField.setAccessible(true);<br /> stringBuilder.append(tmpField.get(tmpObject) == null? "" : tmpField.get(tmpObject));<br /> stringBuilder.append(",");<br /> break;<br /> }
    2. Field field = tmpObject.getClass().getDeclaredField(arr[k]);<br /> //设置对象的访问权限,保证对private的属性的访问<br /> field.setAccessible(true);<br /> tmpObject = field.get(tmpObject);<br /> }<br /> }<br /> }<br /> }catch (Exception ex){<br /> ex.printStackTrace();<br /> }<br /> }//map<br /> stringBuilder.append("\n\t");<br /> }//list.size()<br /> return stringBuilder.toString();<br /> }