|
@@ -5,6 +5,7 @@ import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.alibaba.excel.read.metadata.ReadSheet;
|
|
|
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
|
|
+import com.alibaba.excel.write.metadata.fill.FillWrapper;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.sale.common.CacheUtil;
|
|
|
import com.fdkankan.sale.common.FilePath;
|
|
@@ -55,7 +56,7 @@ public class MyExcelUtil {
|
|
|
//获取文件路径
|
|
|
String templateName = null;
|
|
|
if(type == 0){
|
|
|
- templateName = "orderTemplate.xlsx";
|
|
|
+ templateName = "orderTemplate1.xlsx";
|
|
|
}
|
|
|
if(type == 1){
|
|
|
templateName = "repairTemplate.xlsx";
|
|
@@ -77,24 +78,11 @@ public class MyExcelUtil {
|
|
|
String localFilePath = FilePath.file_path + FilePath.common + "/" + fileName;
|
|
|
File localFile = new File(localFilePath);
|
|
|
ExcelWriter excelWriter = null;
|
|
|
- if(type == 0 ){
|
|
|
- List<CellRangeAddress> list = new ArrayList<>();
|
|
|
- //new CellRangeAddress(开始行,结束行,开始列,结束列)
|
|
|
- list.add(new CellRangeAddress(10, 12, 2, 3));
|
|
|
- list.add(new CellRangeAddress(10, 12, 4, 5));
|
|
|
- list.add(new CellRangeAddress(10, 12, 6, 7));
|
|
|
- excelWriter = EasyExcel.write(localFile)
|
|
|
- .withTemplate(templateFileName)
|
|
|
- //调用合并策略
|
|
|
- .registerWriteHandler(new MyHandler(0, list))
|
|
|
- .build();
|
|
|
- }
|
|
|
- if(type == 1){
|
|
|
- excelWriter = EasyExcel.write(localFile)
|
|
|
- .withTemplate(templateFileName)
|
|
|
- //调用合并策略
|
|
|
- .build();
|
|
|
- }
|
|
|
+
|
|
|
+ excelWriter = EasyExcel.write(localFile)
|
|
|
+ .withTemplate(templateFileName)
|
|
|
+ //调用合并策略
|
|
|
+ .build();
|
|
|
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
// 这里注意 入参用了forceNewRow 代表在写入list的时候不管list下面有没有空行 都会创建一行,然后下面的数据往后移动。默认 是false,会直接使用下一行,如果没有则创建。
|
|
|
// forceNewRow 如果设置了true,有个缺点 就是他会把所有的数据都放到内存了,所以慎用
|