Excel文件导入&导出工具类

Excel导入导出工具类(完整版) ExcelUtil工具类 package com.gdz.excel.util; import java.io.*; import java.lang.reflect.Field; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; import org.apache.poi... 阅读详情

之前写过一篇导出Excel文件的通用类的文章,当时只实现了导出数据到Excel的功能,这次在上次的基础上,增加从Excel读取数据到List的功能,依旧使用POI读取Excel文件。


代码实现

1.在pom.xml中添加POI相关依赖

        <!-- POI -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>5.2.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.2.2</version>
        </dependency>

2.Excel字段注解类

package com.example.study.annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ExcelField {
    /**
     * 排序,该字段值越小,排序越前
     */
    int ordinal() default 0;

    /**
     * 列宽,取值范围0-255,默认16,当列宽<0或>255时,使用默认列宽
     */
    int columnWidth() default 16;

    /**
     * 字段名
     */
    String columnName();

    /**
     * 时间类型的格式化,目前支持Date, LocalDate, LocalTime, LocalDateTime四种时间类型
     */
    String format() default "yyyy-MM-dd HH:mm:ss";
}

3.Excel导入&导出工具类

package com.example.study.util;

import com.example.study.annotation.ExcelField;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * 导出Excel
 */
@Slf4j
public class ExcelUtil {
    /**
     * 读取excel文件内容到List中
     *
     * @param clazz 数据实体类的class
     * @param excel excel文件
     * @param <T>   数据实体类
     * @return 包含指定工作表内容的数据的list
     */
    public static <T> List<T> read(Class<? extends T> clazz, String excel) {
        return read(clazz, excel, null, 0);
    }

    /**
     * 读取excel文件内容到List中
     *
     * @param clazz 数据实体类的class
     * @param excel excel文件
     * @param <T>   数据实体类
     * @return 包含指定工作表内容的数据的list
     */
    public static <T> List<T> read(Class<? extends T> clazz, File excel) {
        return read(clazz, excel, null, 0);
    }

    /**
     * 读取excel文件内容到List中
     *
     * @param clazz       数据实体类的class
     * @param inputStream excel文件
     * @param <T>         数据实体类
     * @return 包含指定工作表内容的数据的list
     */
    public static <T> List<T> read(Class<? extends T> clazz, InputStream inputStream) {
        return read(clazz, inputStream, null, 0);
    }

    /**
     * 读取excel文件内容到List中
     *
     * @param clazz     数据实体类的class
     * @param excel     excel文件
     * @param sheetName 工作表名(默认取第一个工作表)
     * @param <T>       数据实体类
     * @return 包含指定工作表内容的数据的list
     */
    public static <T> List<T> read(Class<? extends T> clazz, String excel, String sheetName, Integer titleRowIndex) {
        Assert.hasText(excel, "excel文件不能为空");
        return read(clazz, new File(excel), sheetName, titleRowIndex);
    }

    /**
     * 读取excel文件内容到List中
     *
     * @param clazz     数据实体类的class
     * @param excel     excel文件
     * @param sheetName 工作表名(默认取第一个工作表)
     * @param <T>       数据实体类
     * @return 包含指定工作表内容的数据的list
     */
    public static <T> List<T> read(Class<? extends T> clazz, File excel, String sheetName, Integer titleRowIndex) {
        Assert.notNull(excel, "excel文件不能为空");
        try {
            InputStream inputStream = new FileInputStream(excel);
            return read(clazz, inputStream, sheetName, titleRowIndex);
        } catch (FileNotFoundException exception) {
            log.error("excel file not exists");
            throw new IllegalArgumentException("excel文件不存在");
        }
    }

    /**
     * 读取excel文件内容到List中
     *
     * @param clazz         数据实体类的class
     * @param inputStream   excel文件
     * @param sheetName     工作表名(默认取第1个工作表)
     * @param titleRowIndex 标题所在行索引(起始地址为0,默认取第1行)
     * @param <T>           数据实体类
     * @return 包含指定工作表内容的数据的list
     */
    public static <T> List<T> read(Class<? extends T> clazz, InputStream inputStream, String sheetName, Integer titleRowIndex) {
        Assert.notNull(clazz, "实体类不能为空");
        Assert.notNull(inputStream, "excel文件不能为空");
        if (titleRowIndex == null || titleRowIndex < 0) {
            titleRowIndex = 0;
        }
        try (XSSFWorkbook workbook = new XSSFWorkbook(inputStream)) {
            XSSFSheet sheet;
            if (StringUtils.hasText(sheetName)) {
                sheet = workbook.getSheet(sheetName);
            } else {
                sheet = workbook.getSheetAt(0);
            }
            Assert.notNull(sheet, "指定或默认的sheet不存在");
            Map<Integer, Field> columnIndexFieldMap = readTitle(clazz, sheet, titleRowIndex);
            Assert.notEmpty(columnIndexFieldMap, "在excel中未找到有效数据");
            return readData(clazz, sheet, titleRowIndex, columnIndexFieldMap);
        } catch (IOException | InstantiationException | IllegalAccessException exception) {
            log.error("throw Exception when read excel:{}", exception.getMessage());
            throw new IllegalArgumentException(exception.getMessage());
        }
    }

    /**
     * 读取excel数据
     *
     * @param clazz               数据实体类的class
     * @param sheet               工作表对象
     * @param titleRowIndex       标题所在行索引
     * @param columnIndexFieldMap 列索引与数据实体类字段Field的映射map
     * @param <T>                 数据实体类
     * @return excel数据
     * @throws IllegalAccessException 没有设置属性的权限
     * @throws InstantiationException 实例化对象失败
     */
    private static <T> List<T> readData(Class<? extends T> clazz, XSSFSheet sheet, Integer titleRowIndex, Map<Integer, Field> columnIndexFieldMap) throws IllegalAccessException, InstantiationException {
        List<T> list = new ArrayList<>();
        for (int rowIndex = titleRowIndex + 1; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
            XSSFRow row = sheet.getRow(rowIndex);
            T data = clazz.newInstance();
            for (Map.Entry<Integer, Field> entry : columnIndexFieldMap.entrySet()) {
                Integer colIndex = entry.getKey();
                Field field = entry.getValue();
                Object value = getCell(row, colIndex, field.getType());
                field.setAccessible(true);
                field.set(data, value);
            }
            list.add(data);
        }
        return list;
    }

    /**
     * 读取excel标题,获取列索引与数据实体类字段Field的映射map
     *
     * @param clazz         数据实体类的class
     * @param sheet         工作表对象
     * @param titleRowIndex 标题所在行索引
     * @return 列索引与数据实体类字段Field的映射map
     */
    private static Map<Integer, Field> readTitle(Class<?> clazz, XSSFSheet sheet, Integer titleRowIndex) {
        List<FieldProperties> properties = getFieldProperties(clazz);
        Map<String, Field> columnNameFieldMap = new HashMap<>();
        for (FieldProperties property : properties) {
            String columnName = property.getExcelField().columnName();
            columnNameFieldMap.put(columnName, property.getField());
        }
        Map<Integer, Field> columnIndexFieldMap = new HashMap<>();
        XSSFRow row = sheet.getRow(titleRowIndex);
        Assert.notNull(row, "指定或默认的标题行不存在");
        for (int columnIndex = 0; columnIndex < row.getLastCellNum(); columnIndex++) {
            String titleName = getCell(row, columnIndex, String.class);
            Field field = columnNameFieldMap.get(titleName);
            if (field != null) {
                columnIndexFieldMap.put(columnIndex, field);
            }
        }
        return columnIndexFieldMap;
    }

    /**
     * 获取单元格内容,单元格内容转为对应字段的类型
     *
     * @param row      行
     * @param colIndex 列索引
     * @param clazz    对应字段类型的class
     * @param <T>      对应字段类型
     * @return 已转为对应字段类型的单元格内容
     */
    private static <T> T getCell(XSSFRow row, int colIndex, Class<? extends T> clazz) {
        XSSFCell cell = row.getCell(colIndex);
        if (cell == null) {
            cell = row.createCell(colIndex);
        }
        String name = clazz.getName();
        Object cellValue;
        switch (name) {
            case "byte":
            case "java.lang.Byte":
                cellValue = (byte) cell.getNumericCellValue();
                break;
            case "short":
            case "java.lang.Short":
                cellValue = (short) cell.getNumericCellValue();
                break;
            case "int":
            case "java.lang.Integer":
                cellValue = (int) cell.getNumericCellValue();
                break;
            case "long":
            case "java.lang.Long":
                cellValue = (long) cell.getNumericCellValue();
                break;
            case "float":
            case "java.lang.Float":
                cellValue = (float) cell.getNumericCellValue();
                break;
            case "double":
            case "java.lang.Double":
                cellValue = cell.getNumericCellValue();
                break;
            case "char":
            case "java.lang.Character":
                cellValue = (char) cell.getNumericCellValue();
                break;
            case "boolean":
            case "java.lang.Boolean":
                cellValue = cell.getBooleanCellValue();
                break;
            case "java.util.Date":
                cellValue = cell.getDateCellValue();
                break;
            case "java.time.LocalDate":
                cellValue = cell.getLocalDateTimeCellValue() == null ? null : cell.getLocalDateTimeCellValue().toLocalDate();
                break;
            case "java.time.LocalTime":
                cellValue = cell.getLocalDateTimeCellValue() == null ? null : cell.getLocalDateTimeCellValue().toLocalTime();
                break;
            case "java.time.LocalDateTime":
                cellValue = cell.getLocalDateTimeCellValue();
                break;
            case "java.lang.String":
                cellValue = cell.toString().trim();
                break;
            case "java.math.BigInteger":
                String strValue = cell.toString().trim();
                int dotIndex = strValue.indexOf('.');
                if (dotIndex >= 0) {
                    strValue = strValue.substring(0, dotIndex);
                }
                cellValue = StringUtils.hasText(strValue) ? new BigInteger(strValue) : null;
                break;
            case "java.math.BigDecimal":
                cellValue = StringUtils.hasText(cell.toString().trim()) ? new BigDecimal(cell.toString().trim()) : null;
                break;
            default:
                cellValue = cell.toString().trim();
        }
        return (T) cellValue;
    }

    /**
     * 导出excel文件
     *
     * @param collection 数据集合
     * @param <T>        数据实体类
     * @return workbook对象
     */
    public static <T> XSSFWorkbook write(Collection<T> collection) {
        return write(collection, null, null);
    }

    /**
     * 导出excel文件
     *
     * @param collection 数据集合
     * @param clazz      数据实体类的class
     * @param <T>        数据实体类
     * @return workbook对象
     */
    public static <T> XSSFWorkbook write(Collection<T> collection, Class<?> clazz) {
        return write(collection, clazz, null);
    }

    /**
     * 导出excel文件
     *
     * @param collection 数据集合
     * @param sheetName  工作表表名
     * @param <T>        数据实体类
     * @return workbook对象
     */
    public static <T> XSSFWorkbook write(Collection<T> collection, String sheetName) {
        return write(collection, null, sheetName);
    }

    /**
     * 导出excel文件
     *
     * @param collection 数据集合
     * @param clazz      数据实体类的class
     * @param sheetName  工作表表名
     * @param <T>        数据实体类
     * @return workbook对象
     */
    public static <T> XSSFWorkbook write(Collection<T> collection, Class<?> clazz, String sheetName) {
        XSSFWorkbook workbook = new XSSFWorkbook();
        XSSFSheet sheet = workbook.createSheet(StringUtils.hasText(sheetName) ? sheetName : "Sheet0");
        XSSFCellStyle titleStyle = createCellStyle(workbook);
        List<FieldProperties> properties = null;
        if (clazz != null) {
            properties = getFieldProperties(clazz);
            writeTitle(sheet, properties, titleStyle);
        }
        if (collection == null || collection.isEmpty()) {
            return workbook;
        }
        if (properties == null) {
            Optional<T> any = collection.stream().filter(o -> o != null).findAny();
            if (!any.isPresent()) {
                return workbook;
            }
            properties = getFieldProperties(any.get().getClass());
            writeTitle(sheet, properties, titleStyle);
        }
        try {
            writeData(sheet, properties, collection);
        } catch (IllegalAccessException exception) {
            log.error("throw IllegalAccessException when writeData:{}", exception.getMessage());
        }
        return workbook;
    }

    /**
     * 返回表头的单元格格式
     *
     * @param workbook workbook对象
     * @return 绿色背景的单元格格式
     */
    private static XSSFCellStyle createCellStyle(XSSFWorkbook workbook) {
        XSSFCellStyle titleStyle = workbook.createCellStyle();
        titleStyle.setFillForegroundColor(IndexedColors.GREEN.getIndex());
        titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        return titleStyle;
    }

    /**
     * 写入数据
     *
     * @param sheet      工作表
     * @param properties 表头
     * @param collection 数据
     * @param <T>        数据实体类
     * @throws IllegalAccessException 访问数据字段值时无访问权限
     */
    private static <T> void writeData(XSSFSheet sheet, List<FieldProperties> properties, Collection<T> collection) throws IllegalAccessException {
        int rowIndex = 1;
        XSSFRow row;
        for (T element : collection) {
            if (element == null) {
                continue;
            }
            row = sheet.createRow(rowIndex++);
            for (int index = 0; index < properties.size(); index++) {
                FieldProperties property = properties.get(index);
                Object value = property.getField().get(element);
                if (value == null) {
                    continue;
                }
                String type = property.getField().getType().getSimpleName();
                switch (type) {
                    case "Date":
                        SimpleDateFormat format = new SimpleDateFormat(property.getExcelField().format());
                        row.createCell(index).setCellValue(format.format(value));
                        break;
                    case "LocalDate":
                    case "LocalTime":
                    case "LocalDateTime":
                        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(property.getExcelField().format());
                        row.createCell(index).setCellValue(formatter.format((TemporalAccessor) value));
                        break;
                    default:
                        row.createCell(index).setCellValue(value.toString());
                }
            }
        }
    }

    /**
     * 写入表头
     *
     * @param sheet      工作表
     * @param properties 表头
     * @param titleStyle 表头格式
     */
    private static void writeTitle(XSSFSheet sheet, List<FieldProperties> properties, XSSFCellStyle titleStyle) {
        XSSFRow row = sheet.createRow(0);
        for (int index = 0; index < properties.size(); index++) {
            ExcelField excelField = properties.get(index).getExcelField();
            String columnName = excelField.columnName();
            XSSFCell cell = row.createCell(index);
            cell.setCellValue(columnName);
            cell.setCellStyle(titleStyle);
            // 设置列宽
            int columnWidth = excelField.columnWidth();
            columnWidth = columnWidth < 0 || columnWidth > 255 ? 16 : columnWidth;
            sheet.setColumnWidth(index, columnWidth * 256);
        }
    }

    /**
     * 获取表头字段
     *
     * @param clazz 数据实体类的class
     * @return 排好序的表头字段
     */
    private static List<FieldProperties> getFieldProperties(Class<?> clazz) {
        Field[] declaredFields = clazz.getDeclaredFields();
        List<FieldProperties> properties = new ArrayList<>();
        for (Field declaredField : declaredFields) {
            ExcelField excelField = declaredField.getAnnotation(ExcelField.class);
            if (excelField == null) {
                continue;
            }
            declaredField.setAccessible(true);
            FieldProperties property = FieldProperties.builder().excelField(excelField).field(declaredField).build();
            properties.add(property);
        }
        properties.sort((o1, o2) -> o1.getExcelField().ordinal() - o2.getExcelField().ordinal());
        return properties;
    }

    @Getter
    @Setter
    @Builder
    private static class FieldProperties {
        private ExcelField excelField;
        private Field field;
    }
}

功能验证

实体类:

package com.example.study.entity;


import com.example.study.annotation.ExcelField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;

@Getter
@Setter
public class StudentEntity {
    @ExcelField(columnName = "Bolid")
    private Boolean bBolid;

    @ExcelField(columnName = "bolid")
    private boolean bolid;

    @ExcelField(columnName = "Bid")
    private Byte bBid;

    @ExcelField(columnName = "bid")
    private byte bid;

    @ExcelField(columnName = "Sid")
    private Short bSid;

    @ExcelField(columnName = "sid")
    private short sid;

    @ExcelField(columnName = "Iid")
    private Integer bIid;

    @ExcelField(columnName = "iid")
    private int iid;

    @ExcelField(columnName = "Lid")
    private Long bLid;

    @ExcelField(columnName = "lid")
    private long lid;

    @ExcelField(columnName = "Fid")
    private Float bFid;

    @ExcelField(columnName = "fid")
    private float fid;

    @ExcelField(columnName = "Did")
    private Double bDid;

    @ExcelField(columnName = "did")
    private double did;

    @ExcelField(columnName = "Cid")
    private Character bCid;

    @ExcelField(columnName = "cid")
    private char cid;

    @ExcelField(columnName = "Bigid")
    private BigInteger Bigid;

    @ExcelField(columnName = "Decid")
    private BigDecimal Decid;

    @ExcelField(columnName = "id")
    private Integer id;

    @ExcelField(columnName = "生日")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date birthday;

    @ExcelField(columnName = "LD生日")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate LdBirthday;

    @ExcelField(columnName = "LT生日")
    @JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalTimeSerializer.class)
    @JsonDeserialize(using = LocalTimeDeserializer.class)
    private LocalTime LtBirthday;

    @ExcelField(columnName = "LDT生日")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime LdtBirthday;

    @ExcelField(columnName = "名字")
    private String name;

    @ExcelField(columnName = "性别")
    private String sex;
}

测试代码:

package com.example.study.test;

import com.example.study.entity.StudentEntity;
import com.example.study.util.ExcelUtil;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.File;
import java.io.FileInputStream;
import java.util.List;

public class ExcelUtilTest {
    public static void main(String[] args) throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        List<StudentEntity> read = ExcelUtil.read(StudentEntity.class, "F:\\tmp\\students.xlsx");
        System.out.println(mapper.writeValueAsString(read));
        read = ExcelUtil.read(StudentEntity.class, new File("F:\\tmp\\students.xlsx"));
        System.out.println(mapper.writeValueAsString(read));
        read = ExcelUtil.read(StudentEntity.class, new FileInputStream("F:\\tmp\\students.xlsx"));
        System.out.println(mapper.writeValueAsString(read));
        read = ExcelUtil.read(StudentEntity.class, "F:\\tmp\\students.xlsx", "sheet2", 1);
        System.out.println(mapper.writeValueAsString(read));
        read = ExcelUtil.read(StudentEntity.class, new File("F:\\tmp\\students.xlsx"), "sheet2", 1);
        System.out.println(mapper.writeValueAsString(read));
        read = ExcelUtil.read(StudentEntity.class, new FileInputStream("F:\\tmp\\students.xlsx"), "sheet2", 1);
        System.out.println(mapper.writeValueAsString(read));
    }
}

excel表内容如下:

sheet1(第一个工作表,左边和上边都没有空行,可使用默认参数):

名字id生日性别BolidbolidBidbidSidsidIidiidLidlidFidfidDiddidCidcidBigidDecidLD生日LT生日LDT生日
张三11995/1/1男TRUEFALSE111111111116597111995/1/11995/1/11995/1/1
李四21995/1/2男FALSETRUE222222222226698221995/1/21995/1/21995/1/2
王冰冰31995/1/3女TRUEFALSE333333333336799331995/1/31995/1/31995/1/3

sheet2(第二个工作表,左边有四列空单元格,上边有一行空行,必须手动指定参数):

名字id生日性别
张三11995/1/1男
李四21995/1/2男
王冰冰31995/1/3女

执行结果如下:

19:46:44.624 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /xl/_rels/workbook.xml.rels
19:46:44.624 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /_rels/.rels
[{"bolid":false,"bid":1,"sid":0,"iid":1,"lid":1,"fid":1.0,"did":1.0,"cid":"a","id":1,"birthday":"1995-01-01 00:00:00","LdBirthday":"1995-01-01","LtBirthday":"00:00:00","LdtBirthday":"1995-01-01 00:00:00","name":"张三","sex":"男","biid":1,"bfid":1.0,"bdid":1.0,"bbolid":true,"bcid":"A","blid":1,"decid":1.0,"bigid":1,"bbid":1,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":1,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"SUNDAY","dayOfYear":1,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":1,"monthValue":1,"era":"CE","dayOfWeek":"SUNDAY","dayOfYear":1,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":1},{"bolid":true,"bid":2,"sid":0,"iid":2,"lid":2,"fid":2.0,"did":2.0,"cid":"b","id":2,"birthday":"1995-01-02 00:00:00","LdBirthday":"1995-01-02","LtBirthday":"00:00:00","LdtBirthday":"1995-01-02 00:00:00","name":"李四","sex":"男","biid":2,"bfid":2.0,"bdid":2.0,"bbolid":false,"bcid":"B","blid":2,"decid":2.0,"bigid":2,"bbid":2,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":2,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"MONDAY","dayOfYear":2,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":2,"monthValue":1,"era":"CE","dayOfWeek":"MONDAY","dayOfYear":2,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":2},{"bolid":false,"bid":3,"sid":0,"iid":3,"lid":3,"fid":3.0,"did":3.0,"cid":"c","id":3,"birthday":"1995-01-03 00:00:00","LdBirthday":"1995-01-03","LtBirthday":"00:00:00","LdtBirthday":"1995-01-03 00:00:00","name":"王冰冰","sex":"女","biid":3,"bfid":3.0,"bdid":3.0,"bbolid":true,"bcid":"C","blid":3,"decid":3.0,"bigid":3,"bbid":3,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":3,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"TUESDAY","dayOfYear":3,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":3,"monthValue":1,"era":"CE","dayOfWeek":"TUESDAY","dayOfYear":3,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":3}]
19:46:45.686 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /xl/_rels/workbook.xml.rels
19:46:45.686 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /_rels/.rels
[{"bolid":false,"bid":1,"sid":0,"iid":1,"lid":1,"fid":1.0,"did":1.0,"cid":"a","id":1,"birthday":"1995-01-01 00:00:00","LdBirthday":"1995-01-01","LtBirthday":"00:00:00","LdtBirthday":"1995-01-01 00:00:00","name":"张三","sex":"男","biid":1,"bfid":1.0,"bdid":1.0,"bbolid":true,"bcid":"A","blid":1,"decid":1.0,"bigid":1,"bbid":1,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":1,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"SUNDAY","dayOfYear":1,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":1,"monthValue":1,"era":"CE","dayOfWeek":"SUNDAY","dayOfYear":1,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":1},{"bolid":true,"bid":2,"sid":0,"iid":2,"lid":2,"fid":2.0,"did":2.0,"cid":"b","id":2,"birthday":"1995-01-02 00:00:00","LdBirthday":"1995-01-02","LtBirthday":"00:00:00","LdtBirthday":"1995-01-02 00:00:00","name":"李四","sex":"男","biid":2,"bfid":2.0,"bdid":2.0,"bbolid":false,"bcid":"B","blid":2,"decid":2.0,"bigid":2,"bbid":2,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":2,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"MONDAY","dayOfYear":2,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":2,"monthValue":1,"era":"CE","dayOfWeek":"MONDAY","dayOfYear":2,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":2},{"bolid":false,"bid":3,"sid":0,"iid":3,"lid":3,"fid":3.0,"did":3.0,"cid":"c","id":3,"birthday":"1995-01-03 00:00:00","LdBirthday":"1995-01-03","LtBirthday":"00:00:00","LdtBirthday":"1995-01-03 00:00:00","name":"王冰冰","sex":"女","biid":3,"bfid":3.0,"bdid":3.0,"bbolid":true,"bcid":"C","blid":3,"decid":3.0,"bigid":3,"bbid":3,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":3,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"TUESDAY","dayOfYear":3,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":3,"monthValue":1,"era":"CE","dayOfWeek":"TUESDAY","dayOfYear":3,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":3}]
19:46:45.765 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /xl/_rels/workbook.xml.rels
19:46:45.765 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /_rels/.rels
[{"bolid":false,"bid":1,"sid":0,"iid":1,"lid":1,"fid":1.0,"did":1.0,"cid":"a","id":1,"birthday":"1995-01-01 00:00:00","LdBirthday":"1995-01-01","LtBirthday":"00:00:00","LdtBirthday":"1995-01-01 00:00:00","name":"张三","sex":"男","biid":1,"bfid":1.0,"bdid":1.0,"bbolid":true,"bcid":"A","blid":1,"decid":1.0,"bigid":1,"bbid":1,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":1,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"SUNDAY","dayOfYear":1,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":1,"monthValue":1,"era":"CE","dayOfWeek":"SUNDAY","dayOfYear":1,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":1},{"bolid":true,"bid":2,"sid":0,"iid":2,"lid":2,"fid":2.0,"did":2.0,"cid":"b","id":2,"birthday":"1995-01-02 00:00:00","LdBirthday":"1995-01-02","LtBirthday":"00:00:00","LdtBirthday":"1995-01-02 00:00:00","name":"李四","sex":"男","biid":2,"bfid":2.0,"bdid":2.0,"bbolid":false,"bcid":"B","blid":2,"decid":2.0,"bigid":2,"bbid":2,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":2,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"MONDAY","dayOfYear":2,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":2,"monthValue":1,"era":"CE","dayOfWeek":"MONDAY","dayOfYear":2,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":2},{"bolid":false,"bid":3,"sid":0,"iid":3,"lid":3,"fid":3.0,"did":3.0,"cid":"c","id":3,"birthday":"1995-01-03 00:00:00","LdBirthday":"1995-01-03","LtBirthday":"00:00:00","LdtBirthday":"1995-01-03 00:00:00","name":"王冰冰","sex":"女","biid":3,"bfid":3.0,"bdid":3.0,"bbolid":true,"bcid":"C","blid":3,"decid":3.0,"bigid":3,"bbid":3,"ltBirthday":{"hour":0,"minute":0,"second":0,"nano":0},"ldtBirthday":{"month":"JANUARY","year":1995,"dayOfMonth":3,"hour":0,"minute":0,"monthValue":1,"nano":0,"second":0,"dayOfWeek":"TUESDAY","dayOfYear":3,"chronology":{"id":"ISO","calendarType":"iso8601"}},"ldBirthday":{"year":1995,"month":"JANUARY","dayOfMonth":3,"monthValue":1,"era":"CE","dayOfWeek":"TUESDAY","dayOfYear":3,"leapYear":false,"chronology":{"id":"ISO","calendarType":"iso8601"}},"bsid":3}]
19:46:45.858 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /xl/_rels/workbook.xml.rels
19:46:45.905 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /_rels/.rels
[{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":1,"birthday":"1995-01-01 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"张三","sex":"男","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null},{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":2,"birthday":"1995-01-02 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"李四","sex":"男","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null},{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":3,"birthday":"1995-01-03 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"王冰冰","sex":"女","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null}]
19:46:45.983 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /xl/_rels/workbook.xml.rels
19:46:45.983 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /_rels/.rels
[{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":1,"birthday":"1995-01-01 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"张三","sex":"男","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null},{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":2,"birthday":"1995-01-02 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"李四","sex":"男","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null},{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":3,"birthday":"1995-01-03 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"王冰冰","sex":"女","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null}]
19:46:46.030 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /xl/_rels/workbook.xml.rels
19:46:46.030 [main] DEBUG org.apache.poi.openxml4j.opc.PackageRelationshipCollection - Parsing relationship: /_rels/.rels
[{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":1,"birthday":"1995-01-01 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"张三","sex":"男","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null},{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":2,"birthday":"1995-01-02 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"李四","sex":"男","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null},{"bolid":false,"bid":0,"sid":0,"iid":0,"lid":0,"fid":0.0,"did":0.0,"cid":"\u0000","id":3,"birthday":"1995-01-03 00:00:00","LdBirthday":null,"LtBirthday":null,"LdtBirthday":null,"name":"王冰冰","sex":"女","biid":null,"bfid":null,"bdid":null,"bbolid":null,"bcid":null,"blid":null,"decid":null,"bigid":null,"bbid":null,"ltBirthday":null,"ldtBirthday":null,"ldBirthday":null,"bsid":null}]
Poi导出Excel工具类 一、概述 在工作过程中,都会遇到这样一个需求,就是将相关的数据列表导出成excel,这里写成通用的导出Excel的工具。 二、项目实现 1、构建pom.xml 我的工程是利用Maven来构建的,这里仅给出最核心的包 &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.apache.poi&amp;lt;/groupId&amp;gt; &amp;lt;artifactI... 阅读详情

相关推荐

Excel 导入导出(前端处理:xslx)(后端处理:hutool+poi || Easy Excel )

判断前端是否有传过来ids,有就将其转成数组并queryWrapper查询出,没有就根据其他条件查询出数据列表。: Hutool-poi 模块中的一个工具类,用于处理 Excel 文件的读写。导出全部的可向后端传入ids.join(',')//把数组转成字符串。只需要在实体类的属性上面加一个注解 @Alias("中文")查询出来的list里是一条条user对象,所以有键值对。对象,比如获取工作表、将工作表转换为 JSON 等。方法会将文件读取为二进制数据缓冲区,即。对象的两种不同读取文件的方式。

qq_51985869的博客 3021

Excel 导入导出、样式设计、Excel各种工具类整合,FileUtil、ExcelUtil

样式设计可参考:https://apidoc.gitee.com/loolly/hutool/cn/hutool/poi/excel/ExcelWriter.html。下述工具类会不断完善,欢迎提出意见,由于为实现复杂需求,所以代码从excel拿数据拿的比较细致,未作代码优化。

qq_43358385的博客 1395

Excel导出工具类--复杂的excel功能导出(使用自定义注解导出)

前言: 简单的excel导出,可以用easy-excel, fast-excel, auto-poi,在导出实体类上加上对应的注解,用封装好的工具类直接导出,但对于复杂的场景, 封装的工具类解决不了,要用原生的excel导出(easy-excel, fast-excel, auto-poi都支持原生的)业务场景: 具体实现如下:前端传值:用数组fieldNameList 定义用户勾选的需要导出的字段: fieldNameList = [“productName”,“moduleName”,“quotePro

专搞技术的小兔子 483

Excel常用导入导出工具类

【代码】Excel常用导入导出工具类。

ls18802694089的博客 743

ROS2实战:打造智能巡检机器人的关键技术与实现

本文详细介绍了基于ROS2和Navigation2构建智能巡检机器人的完整实战流程。通过设计主从协作的事件驱动架构,实现了机器人在已知地图中的自动导航、定点语音播报和环境图像采集功能。文章涵盖了从环境搭建、仿真配置到核心控制节点、语音服务与图像记录模块的代码实现,为开发者打造实用的自动巡检机器人提供了清晰的技术指南。

weixin_29031057的博客 226

Calibre提参实战:如何用hcell和xcell文件精准屏蔽模块(附避坑指南)

本文详细解析了Calibre提参过程中hcell和xcell文件的应用技巧,帮助工程师精准屏蔽模块以优化寄生参数提取。通过对比hcell与xcell的核心差异、图形界面与命令行操作指南,以及常见问题排查方法,提升芯片后端设计效率。附避坑指南,解决EETOP论坛热议的模块丢失问题。

weixin_26795617的博客 440

HuTool工具类使用之Excel文档的导入导出

HuTool工具类使用Excel文档的导入导出 前言 在日常的工作开发中,Excel的导入和导出是必不可少的,如果自己写相应的导入导出方法,会显得十分繁琐,本文采用Hutool工具类实现的Excel导入导出功能,可以大幅度减少今后开发中Excel的导入导出的相关操作。 提示:以下是本篇文章正文内容,下面案例可供参考 一、Hutool是什么? &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Hutool是一个小而全的Java工具类库,通过静态方法封装,降低相关API的学习成本,

一直扫地僧 1万+

微电网模型Matlab Simulink,风光储微电网,永磁风机并网仿真,光伏并网仿真,蓄电池仿真

通过探究风光储微电网、永磁风机并网仿真、光伏并网仿真、蓄电池仿真、柴油发电机以及光储微电网和风储微电网等方面的技术,我们可以更好地理解微电网的工作原理和优化方法,从而为微电网的发展做出更大的贡献。微电网模型Matlab Simulink,风光储微电网,永磁风机并网仿真,光伏并网仿真,蓄电池仿真,柴油发电机,光储微电网 风储微电网 Matlab仿真平台搭建的风光储微电网模型,风光柴储微电网,pwm控制,风力发电,光伏发电,微电网并网离网切换,并网孤岛切换,功能强大。永磁风机的并网仿真是一个非常重要的环节。

sjbextz的博客 400

Java poi 实现excel导入导出工具类

最近项目上又要大量的涉及excel导入导出,网上各种导入导出的方式层出不穷,我是比较青睐官方的poi,但是要自己去操作工作簿对象自己一行一行的读取,会有很多的重复代码,重复劳动,也极为不美观,基于合成/聚合复用程序设计原则,降低耦合,所以提出来基于poi写了这套工具类。以前也写过类似的工具类,由于项目进度问题,没写博客记录,导致这次用的时候找不到了(此处捂脸一分钟),于是痛定思痛,又封装了这一套,写完赶紧写个博客记录下,方便自己以后有需要时查阅,如得各位大佬享用,荣幸之至,所有方法已在项目中验证,可直接使用

百块富翁的博客 8648

解密TMS320F28377D双核工程中的内存分配艺术:从CMD文件到实战优化

本文深入解析TMS320F28377D双核DSP的内存管理艺术,从CMD文件配置到实战优化技巧。详细介绍了SARAM、GSRAM等内存类型的特性与配置方法,提供双核协同、性能优化及高级调试的实用方案,帮助开发者提升系统实时性和稳定性。

weixin_29190651的博客 663

从高德、百度地图下载POI数据?用这个工具5分钟搞定GCJ02/BD09到WGS84的坐标纠偏

本文详细解析了高德、百度地图POI数据坐标偏移问题,并提供了从GCJ02/BD09到WGS84的高效转换方案。通过开源工具如coordtransform和ArcGIS等专业软件,实现毫米级精度的坐标纠偏,适用于商业选址、GIS分析等场景,显著提升数据准确性和工作效率。

weixin_26789847的博客 450

excel导入导出工具类

使用java导出导入excel工具类 文章目录使用java导出导入excel工具类导出导出工具类导入工具类1工具类2 导出 /** * * @return */ @Override public File exportLogInfo() { Map&lt;String,Object&gt; resultMap = new HashMap&lt;String, Object&gt;(); String sqlExceptSelect

qq_24790827的博客 1701

如何懂固高卡以及滚筒轴+平移轴配合运动?

🏆本文收录于专栏,主要记录项目实战过程中所遇到的Bug或因后果及提供真实有效的解决方案,希望能够助你一臂之力,帮你早日登顶实现财富自由🚀;同时,欢迎大家!持续更新中,up!up!up!!

**My Coding Family** 853

Java实现导入导出excel功能以及excel工具类

一、背景 当前B/S模式已经成为应用开发的主流模式,而在企业办公中,常常会遇到需要将统计报表导出和将整理好的数据导入系统的需求,最近刚好遇到了一个这样的需求,现将已经做完的代码分享出来。 二、导入导出 1、导入 导入功能相对比较简单,只需要在接口使用MultipartFile类型接收前台传过来的文件即可,然后将此文件转存到本地文件中,我是这么处理的,仅供参考,实现方式多样,然后就可以...

weixin_39080216的博客 1647

人形机器人开源资源大盘点(四):硬件开源平台

开源人形机器人平台推动技术民主化 本期聚焦四大开源人形机器人平台:斯坦福的ToddlerBot以6000美元低成本实现30自由度运动,支持仿真到现实的零样本迁移;法国Reachy2被HuggingFace收购,融合开源AI与硬件,适配医疗、工业等场景;国内OriginMan基于ROS2全开源,集成大模型能力,支持深度改造;OAN框架则为经典NAO机器人注入开源活力,扩展交互功能。这些平台通过不同路径降低研发门槛,推动人形机器人技术走向开放共享的未来。

Studying…… 370

让闲置 MacBook 当 OpenClaw 主机:合盖运行 + 后台常驻

摘要 本文详细介绍如何将闲置MacBook改造为OpenClaw服务器,实现合盖后持续运行。首先推荐Ubuntu 22.04 LTS作为操作系统,提供详细的安装步骤和分区建议。重点介绍三种禁用合盖休眠的方法:修改systemd-logind配置、使用pm-utils工具以及调整GRUB设置。随后指导如何安装Docker并部署OpenClaw服务,包括创建docker-compose.yml文件和配置环境变量。最后说明如何设置系统服务实现OpenClaw开机自启。通过以上配置,可使MacBook在合盖状态下7

一键难忘的博客 4657

Excel 导入导出工具类文档

ExcelProperty("员工ID")@ExcelProperty("员工姓名")@ExcelProperty(value = "入职日期", dateFormat = "yyyy年MM月dd日")@ExcelProperty("薪资")@ExcelProperty("是否在职")// 省略 getter/setter开箱即用:简单注解配置即可实现复杂导入导出功能高度可定制:支持自定义列名、日期格式、列宽等智能类型转换:自动处理常见数据类型转换企业级健壮性。

qq_37935324的博客 2525

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

Easypoi导出、导入excel

所需pom依赖: &lt;!-- 引入EasyPoi包 --&gt; &lt;dependency&gt; &lt;groupId&gt;cn.afterturn&lt;/groupId&gt; &lt;artifactId&gt;easypoi-spring-boot-starter&lt;/artifactId&gt; &lt;version&gt;4.1.0&lt;/version&gt; &lt;/dependency&gt; &lt;de.

在下令狐的博客 7425

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

【java超方便的导入导出工具类】SpringBoot操作Excel导入和导出

超方便的SpringBoot+Excel导入导出,值得你研究。

qq_53438100的博客 2734

springboot封装Excel导入导出工具类

本文分享了SpringBoot项目中使用Apache POI进行Excel导入导出的实现方案。导入部分通过自定义注解标记实体类字段,利用反射机制将Excel数据映射到实体对象;导出部分采用函数式接口设计,支持灵活的样式自定义。文章详细讲解了核心代码实现,包括依赖引入、注解定义、反射处理、样式回调等关键点,并提供了Swagger3的API测试示例。

x2235103871的博客 1009

POI导出导入Excel工具类(原来Excel导入导出这么简单)

POI导出/导入Excel工具类(原来Excel导入导出这么简单) 一.首先废话不多说,先导包 &lt;!--POI相关坐标--&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.poi&lt;/groupId&gt; &lt;artifactId&gt;poi&lt;/artifactId&gt; &lt;vers...

weixin_45152583的博客 918

Excel实现多Sheet文件导入导出

实现Excel的多Sheet导入导出

sjzym优快云的博客 2874

Java导入导出Excel工具类ExcelUtil

/改成输出excel文件。* @Description : 导出Excel(可以导出到本地文件系统,也可以导出到浏览器,工作表大小为2003支持的最大值)导入和导出方法都是通过传一个fieldMap参数(类的英文属性和Excel的中文列头的对应关系)来连接实体类和Excel的。* @Description : 导出Excel(导出到浏览器,工作表的大小是2003支持的最大值)下面就是该文的主角ExcelUtil登场了,作为一个工具类,其内的所有方法都是静态的,方便使用。

耿颖才的博客 1534

JAVA中的EXCEL导入导出

前言提示:注意看文字的提醒:例如:提示: 就这几个表别搞乱了就行其实很简单ExcelClassField ------ Excel标题栏工具类–不用管ExcelExport------导出配置工具类—用于对象表的配置上ExcelImport----导入配置工具类—用于对象表的配置上ExcelUtils-----用于接口调用上。

weixin_73412838的博客 1193

Excel导入导出工具类

目录 1.mavn jar 2 工具类代码 2.1 ExcelUtil 2.2 引用自写类 2.2.1 ExcelMsg 2.2.2 CellDataType 2.2.3 SaxReadExcelUtil 1.mavn jar &lt;!-- excel poi jar --&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.poi&lt;/groupId&gt; &lt;artifactId&gt;poi&

谨 585

SpringBoot-Excel导入导出工具类

自定义工具类 包含上传和下载 package com.yl.www.utils; /** * create by Dannimeiyou for 2020/11/14 13:08 * excel导出工具类 */ import com.yl.www.po.User; import lombok.extern.slf4j.Slf4j; import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ss.usermodel.Cell; imp

qq_43510643的博客 932
上一篇: 分别使用dom4j和jdk自带的方法解析xml文件
下一篇: 使用EasyExcel读写Excel文件
java_t_t
博客等级 码龄9年 171粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值