Skip to content

Commit

Permalink
fix issue 46 51
Browse files Browse the repository at this point in the history
  • Loading branch information
linxunan1437 committed Dec 5, 2023
1 parent ef895a6 commit 26ae4f5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/kotlin/SpellLog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object SpellLog {
val file = File("log.xlsx")
if (!file.exists()) file.createNewFile()
val os = ByteArrayOutputStream()
XSSFWorkbook(OPCPackage.open(file, PackageAccess.READ)).use { wb ->
XSSFWorkbook(OPCPackage.open(file, PackageAccess.READ_WRITE)).use { wb ->
for (i in 0 until logList.size) {
val sheet = wb.getSheetAt(i)
for (model in logList[i]) {
Expand Down Expand Up @@ -158,8 +158,15 @@ object SpellLog {
val sheet = wb.getSheetAt(0)
val logSheet = logWB.getSheetAt(j)
for (i in 1..sheet.lastRowNum) {
logSheet.createRow(i).createCell(0)
.setCellValue(sheet.getRow(i).getCell(3).stringCellValue.trim())
sheet.getRow(i).getCell(3).stringCellValue.trim().let {
logSheet.createRow(i).createCell(0)
.setCellValue(it)
// 新增的符卡需要增加到现有列表中
if (logList.isNotEmpty() && logList[j][it] == null) {
logList[j][it] =
LogModel(sheet.getRow(i).getCell(1).numericCellValue.toInt(), 0, 0, 0, 0)
}
}
}
}
}
Expand Down

2 comments on commit 26ae4f5

@CuteReimu
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix #46

@CuteReimu
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix #51

Please sign in to comment.