-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1521e9e
commit ae9f386
Showing
6 changed files
with
174 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
easyexcel-test/src/test/java/com/alibaba/easyexcel/test/temp/poi/PoiDateFormatTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.alibaba.easyexcel.test.temp.poi; | ||
|
||
import java.io.IOException; | ||
|
||
import org.apache.poi.ss.usermodel.DateUtil; | ||
import org.apache.poi.xssf.usermodel.XSSFCell; | ||
import org.apache.poi.xssf.usermodel.XSSFRow; | ||
import org.apache.poi.xssf.usermodel.XSSFSheet; | ||
import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
import org.junit.jupiter.api.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* 测试poi | ||
* | ||
* @author Jiaju Zhuang | ||
**/ | ||
|
||
public class PoiDateFormatTest { | ||
private static final Logger LOGGER = LoggerFactory.getLogger(PoiDateFormatTest.class); | ||
|
||
@Test | ||
public void read() throws IOException { | ||
String file | ||
= "/Users/zhuangjiaju/IdeaProjects/easyexcel/easyexcel-test/src/test/resources/dataformat/dataformat.xlsx"; | ||
XSSFWorkbook xssfWorkbook = new XSSFWorkbook( file); | ||
XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0); | ||
LOGGER.info("一共行数:{}", xssfSheet.getLastRowNum()); | ||
XSSFRow row = xssfSheet.getRow(7); | ||
XSSFCell cell = row.getCell(0); | ||
LOGGER.info("dd{}", cell.getDateCellValue()); | ||
LOGGER.info("dd{}", cell.getNumericCellValue()); | ||
|
||
LOGGER.info("dd{}", DateUtil.isCellDateFormatted(cell)); | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters