当前位置:网站首页>Easyexcel read file
Easyexcel read file
2022-06-26 01:47:00 【NewBee. Mu】
public XSSFSheet bulkLoad(MultipartFile file) {
try {
InputStream inputStream = new ByteArrayInputStream(file.getBytes());
XSSFWorkbook workbook = new XSSFWorkbook(inputStream);
XSSFSheet sheet = workbook.getSheetAt(0);
// Determine whether it is a template document
XSSFRow row1 = sheet.getRow(0);
XSSFCell cell = row1.getCell(0);
cell.setCellType(CellType.STRING);
String stringCellValue = cell.getStringCellValue();
int physicalNumberOfCells = row1.getPhysicalNumberOfCells();
if (!" ID number ".equals(stringCellValue) || physicalNumberOfCells != 10){
return null;
}
return sheet;
} catch (IOException | StringIndexOutOfBoundsException e) {
return null;
}
}
This method performs template verification , Verify whether the first row and the first column are ID number , Is there a total of 10 A title , If not , There is a problem with the template
public void bulkLoadContent(XSSFSheet sheet) {
Integer rows = sheet.getPhysicalNumberOfRows();
XSSFRow row;
PatientInformation patientInformation = new PatientInformation();
RegisterInformation registerInformation = new RegisterInformation();
BasicInformationImportLog importLog = new BasicInformationImportLog();
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
boolean flag;
for (int i = 1; i < rows; i++) {
flag = true;
StringBuffer buffer = new StringBuffer();
// For the first i Row data
row = sheet.getRow(i);
if (row == null) {
continue;
}
// The value of the first column
String value= StringTrim(row.getCell(0).getStringCellValue());
.
.
.
.
.
.
}
}
Here you can traverse to get excel The values in the table and deal with them
边栏推荐
- Android system startup security
- GUN make (3) Makefile的规则
- Install tensorflow GPU miscellaneous
- Talking about interface test (2)
- Summary of in-depth learning optimization techniques
- Oracle database complete uninstallation steps (no screenshot)
- 分布式系统(二)分布式事务的理解
- 22. pixel remapping
- PTA class a simulated fifth bomb: 1148-1151
- Model integration and cascading
猜你喜欢

--都市修炼手册之SQL-- 第一章 基础复习

The 19th - 22nd week of scientific research training - about tnet and memnet

阳光男孩陈颢天 受邀担任第六季完美童模全球总决赛代言人

RT thread project engineering construction and configuration - (Env kconfig)

20. Hough line transformation

Talking about interface test (2)

25. histogram comparison

Basic concepts of machine learning

Oracle数据库开启备份准备工作

GNN (graph neural network) introduction vernacular
随机推荐
判定积分给业务带来价值的两个指标
24. histogram calculation
JSON introduction
tos cos dscp 区别和作用
JQ 自定义属性取值
Model integration and cascading
热血男孩滕文泽 受邀担任第六季完美童模全球总决赛形象大使
User unlock status query
从在浏览器的输入框输入一个网址,到看到网页的内容,这个过程中发生了什么?
浅谈接口测试(一)
正则表达式
阳光男孩陈颢天 受邀担任第六季完美童模全球总决赛代言人
PTA class a simulated seventh bomb: 1160-1163
JQ user defined attribute value
Postman接口测试之断言
21. Hoff circle transformation
--都市修炼手册之SQL-- 第一章 基础复习
2021-1-15 摸鱼做的笔记Ctrl+c /v来的
xargs 的作用详解
Test questions and answers for the 2022 baby sitter (Level 5) examination