浏览代码

商品调价单导入调整

郭齐峰 1 年之前
父节点
当前提交
216ba250a3
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      src/custom/restcontroller/webmanage/sale/itempriceadjust/ItempriceadjustItemprice.java

+ 10 - 0
src/custom/restcontroller/webmanage/sale/itempriceadjust/ItempriceadjustItemprice.java

@@ -10,7 +10,9 @@ import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.data.*;
 import org.apache.commons.lang.StringUtils;
+import org.apache.poi.ss.usermodel.CellStyle;
 import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.DataFormat;
 import org.apache.poi.xssf.usermodel.*;
 import restcontroller.R;
 import restcontroller.system.attachment.Attachment;
@@ -430,6 +432,14 @@ public class ItempriceadjustItemprice extends Controller {
 
         XSSFSheet sheet = excelFactory.getXssfWorkbook().createSheet("Sheet1");
         XSSFWorkbook xssfFWorkbook = excelFactory.getXssfWorkbook();
+
+        CellStyle style = xssfFWorkbook.createCellStyle();
+        // 设置为文本格式,防止身份证号变成科学计数法
+        DataFormat format = xssfFWorkbook.createDataFormat();
+        style.setDataFormat(format.getFormat("@"));
+        // 对单独某一列进行样式赋值,第一个参数为列数,第二个参数为样式
+        sheet.setDefaultColumnStyle(0, style);
+
         ExportExcel.setBatchDetailSheetColumn1(sheet);// 设置工作薄列宽
         XSSFCellStyle titleCellStyle1 = ExportExcel.createTitleCellStyle1(xssfFWorkbook);
         XSSFCellStyle titleCellStyle2 = ExportExcel.createTitleCellStyle2(xssfFWorkbook);