diff --git a/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java b/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java index 8c9badfe..63141ba4 100644 --- a/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java +++ b/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/Lock2Test.java @@ -37,7 +37,7 @@ public class Lock2Test { // File file = TestFileUtil.readUserHomeFile("test/test6.xls"); File file = new File("/Users/zhuangjiaju/IdeaProjects/easyexcel/src/test/resources/converter/converter07.xlsx"); - List list = EasyExcel.read("/Users/zhuangjiaju/test/test3.xlsx").sheet(0).headRowNumber(0).doReadSync(); + List list = EasyExcel.read("/Users/zhuangjiaju/Downloads/测试格式.xlsx").sheet(0).headRowNumber(0).doReadSync(); LOGGER.info("数据:{}", list.size()); for (Object data : list) { LOGGER.info("返回数据:{}", CollectionUtils.size(data)); diff --git a/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/poi/PoiFormatTest.java b/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/poi/PoiFormatTest.java index 1f31f9cc..a9e2ce36 100644 --- a/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/poi/PoiFormatTest.java +++ b/easyexcel-core/src/test/java/com/alibaba/easyexcel/test/temp/poi/PoiFormatTest.java @@ -2,11 +2,17 @@ package com.alibaba.easyexcel.test.temp.poi; import java.io.File; import java.io.IOException; +import java.util.Locale; +import org.apache.poi.hssf.usermodel.HSSFDataFormatter; +import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.streaming.SXSSFRow; import org.apache.poi.xssf.streaming.SXSSFSheet; import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFDataFormat; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -40,14 +46,15 @@ public class PoiFormatTest { @Test public void lastRowNumXSSF() throws IOException { - String file = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx"; + String file = "/Users/zhuangjiaju/Downloads/测试格式.xlsx"; XSSFWorkbook xssfWorkbook = new XSSFWorkbook(file); LOGGER.info("一共:{}个sheet", xssfWorkbook.getNumberOfSheets()); XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0); LOGGER.info("一共行数:{}", xssfSheet.getLastRowNum()); - XSSFRow row = xssfSheet.getRow(0); - LOGGER.info("第一行数据:{}", row); - xssfSheet.createRow(20); - LOGGER.info("一共行数:{}", xssfSheet.getLastRowNum()); + XSSFRow row = xssfSheet.getRow(1); + XSSFCell xssfCell = row.getCell(0); + DataFormatter d = new DataFormatter(Locale.CHINA); + LOGGER.info("fo:{}", d.formatCellValue(xssfCell)); + } }