From 196bb14112448857a885e32dc4149e308e00b01a Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 15 八月 2024 11:57:15 +0800 Subject: [PATCH] 2024.8.15 各项修正 --- src/main/kotlin/cn/flightfeather/supervision/infrastructure/utils/ExcelUtil.kt | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/infrastructure/utils/ExcelUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/infrastructure/utils/ExcelUtil.kt index 6a3d664..4bc2b71 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/infrastructure/utils/ExcelUtil.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/infrastructure/utils/ExcelUtil.kt @@ -22,19 +22,20 @@ /** * 鑷姩澶勭悊琛屽悎骞舵暟鎹� */ - fun write2(heads: List<Array<String>>, contents: List<Array<Any>>, workbook: HSSFWorkbook, sheetName: String = "sheet1") { + fun write2(heads: List<Array<Any>>, contents: MutableList<Array<Any>>, workbook: HSSFWorkbook, sheetName: String = "sheet1") { val sheet = workbook.createSheet(sheetName) var rowIndex = 0 - heads.forEach { - val rows = sheet.createRow(rowIndex) - for (i in it.indices) { - rows.createCell(i).setCellValue(it[i]) - } - rowIndex++ - } +// heads.forEach { +// val rows = sheet.createRow(rowIndex) +// for (i in it.indices) { +// rows.createCell(i).setCellValue(it[i]) +// } +// rowIndex++ +// } + contents.addAll(0, heads) contents.forEach { val maxRow = getMaxRows(it) @@ -101,6 +102,7 @@ rows.createCell(col).setCellValue(c) println("write1-2: ${c};($rowIndex, ${col})") } + is Int -> rows.createCell(col).setCellValue(c.toDouble()) is Double -> rows.createCell(col).setCellValue(c) is Boolean -> rows.createCell(col).setCellValue(c) is Date -> rows.createCell(col).setCellValue(c) @@ -151,6 +153,7 @@ rows.createCell(map.key).setCellValue(c) println("write2-2: ${c};($_rowIndex, ${map.key})") } + is Int -> rows.createCell(col).setCellValue(c.toDouble()) is Double -> rows.createCell(map.key).setCellValue(c) is Boolean -> rows.createCell(map.key).setCellValue(c) is Date -> rows.createCell(map.key).setCellValue(c) -- Gitblit v1.9.3