当前位置:网站首页>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
边栏推荐
猜你喜欢

20. Hough line transformation

Simple making of master seal

Obtain WiFi password through computer (only connected WiFi)

The overall process of adding, deleting, modifying and querying function items realized by super detailed SSM framework

GNN (graph neural network) introduction vernacular

王老吉药业“关爱烈日下最可爱的人”公益活动在杭启动

蒟蒻初学单片机的一丢丢笔记

Installing MySQL databases in FreeBSD

浅谈接口测试(二)

Talking about interface test (I)
随机推荐
通过电脑获取WIFI密码(只能连接过的WiFi)
Worthington胶原蛋白酶的多类型研究
Exploring temporary information for dynamic network embedding
NLP enhanced technology
微信朋友圈测试点
CityJSON
胶原蛋白酶丨Worthington中英文说明书
CYCA少儿形体礼仪 乐清市培训成果考核圆满落幕
makefile 中export set ENV 的区别和作用
What is the process of opening a mobile card account? Is it safe to open an account online?
Summary of in-depth learning optimization techniques
JSON introduction
Summary of informer's paper
Loss function of depth model
Install tensorflow GPU miscellaneous
leetcode 300. Longest increasing subsequence (medium)
Perfdog
Is it safe to log in the stock account on the flush? How to open a stock account in the flush
GUN make (5) makefile中的变量
Common basic Oracle commands