日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

Excel單元格空,設置為空字符串

作者:自由_free 更新時間: 2022-05-11 編程語言

Java使用hutool工具類解析Excel,單元格空,賦值為空字符串

		ExcelReader jobExcel = ExcelUtil.getReader(file.getInputStream(), 0);
		Sheet sheet = jobExcel.getSheet();
        int lastCellNum = sheet.getRow(Constants.EXCEL_READ_HEADER_ROW).getLastCellNum();
        int rowCount = jobExcel.getRowCount();
        for (int i = Constants.EXCEL_READ_ROW_VALUE; i < rowCount; i++) {
            Row row = sheet.getRow(i);
            for (int cellNum = 0; cellNum < lastCellNum; cellNum++) {
                row.getCell(cellNum, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
            }
        }
        List<List<Object>> read = jobExcel.read(1);

Pom文件

		<dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.0.0</version>
        </dependency>

        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.7.11</version>
        </dependency>

原文鏈接:https://blog.csdn.net/weixin_49194846/article/details/124677377

欄目分類
最近更新