From e40b81672a0c9c2ccdbacc785854752b6c7291b8 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 9 Oct 2023 00:18:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=99=E4=BA=86=E4=B8=A4=E4=B8=AA=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E5=87=BD=E6=95=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/cpic/xim/utils/poi/MyPOIUtils.java | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/poi/MyPOIUtils.java diff --git a/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/poi/MyPOIUtils.java b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/poi/MyPOIUtils.java new file mode 100644 index 0000000..19d964d --- /dev/null +++ b/code/后端/desktop_archievement_backend/src/main/java/com/cpic/xim/utils/poi/MyPOIUtils.java @@ -0,0 +1,41 @@ +/* + * @Author: Kane + * @Date: 2023-10-08 22:12:05 + * @LastEditors: Kane + * @FilePath: /desktop_archievement_backend/src/main/java/com/cpic/xim/utils/poi/MyPOIUtils.java + * @Description: POI相关的工具 + * + * Copyright (c) ${2023} by Kane, All Rights Reserved. + */ +package com.cpic.xim.utils.poi; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; + +public class MyPOIUtils +{ + public String getStringCellValue( Cell cell ) + { + switch( cell.getCellType() ) + { + case STRING: + return cell.getStringCellValue(); + default: + return ""; + } + } + + public String getStringCellValue( Row row, int columnIndex ) + { + Cell cell = row.getCell(columnIndex, MissingCellPolicy.RETURN_NULL_AND_BLANK); + + switch( cell.getCellType() ) + { + case STRING: + return cell.getStringCellValue(); + default: + return ""; + } + } +} \ No newline at end of file