文档拆分-模板格式修改
This commit is contained in:
+15
-2
@@ -63,10 +63,12 @@ import org.apache.http.entity.ContentType;
|
||||
import org.apache.poi.common.usermodel.HyperlinkType;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -2625,6 +2627,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
XSSFCellStyle cellStyle = workbook.createCellStyle();
|
||||
cellStyle.setWrapText(true);//自动换行
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("@")); // 设置文本格式
|
||||
|
||||
//合并单元格
|
||||
CellRangeAddress region1 =
|
||||
@@ -2638,7 +2641,13 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
if (i == 0) {
|
||||
if (StringUtils.isNotBlank(exportFieldName)) {
|
||||
String[] headerArr = exportFieldName.split(",");
|
||||
String[] headerTypeArr = list.get(3).split(",");
|
||||
|
||||
for (int j = 0; j < headerArr.length; j++) {
|
||||
// 条款号和输入框数字类型 列 设置单元格格式为文本
|
||||
if ("*条款号".equals(headerArr[j]) || "*Item No.".equals(headerArr[j]) || FieldTypeEnum.TEXT_NUMBER.getValue().equals(headerTypeArr[j])) {
|
||||
sheet.setDefaultColumnStyle(j, cellStyle);
|
||||
}
|
||||
row.createCell(j).setCellValue(headerArr[j]);
|
||||
}
|
||||
}
|
||||
@@ -2713,6 +2722,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// 获取新增表单字段
|
||||
List<Map<String, Object>> addForm = list;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder sbOfType = new StringBuilder();
|
||||
List<String> pullMoreList = new LinkedList<>();//多选字段
|
||||
List<String> pullSingleList = new LinkedList<>();//单选字段
|
||||
List<String> fileList = new LinkedList<>();//文件字段
|
||||
@@ -2729,6 +2739,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
sb.append(map.get("db_field_txt") + ",");
|
||||
}
|
||||
String fieldShowType = "field_show_type";
|
||||
sbOfType.append(map.get(fieldShowType) + ",");
|
||||
//多选字段
|
||||
if (FieldTypeEnum.PULL_MORE.getValue().equals(map.get(fieldShowType))) {
|
||||
pullMoreList.add((String) map.get("db_field_txt"));
|
||||
@@ -2759,6 +2770,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
}
|
||||
String title = sb.substring(0, sb.length() - 1);
|
||||
String type = sbOfType.substring(0, sbOfType.length() - 1);
|
||||
|
||||
//第二行
|
||||
StringBuilder sbTwo = new StringBuilder();
|
||||
@@ -2864,6 +2876,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
resultList.add(title);
|
||||
resultList.add(sbTwo.toString());
|
||||
resultList.add(count + "");
|
||||
resultList.add(type);
|
||||
return resultList;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user