Skip to content

hoaronal-project/excel-plus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

excel-plus

Easier to read and generate an excel file, supports XLSXXLSCSV.

EO principles respected here DevOps By Rultor.com

Javadocs

codecov SonarQube

中文文档

Feature

  • Easy to use
  • Annotation driven
  • Based java 8
  • Support xlsxlsxcsv
  • Support export by template
  • Support custom column style
  • High performance, only 30 seconds to read or write 1,000,000 lines

Usage

How to use. Latest version here

<dependency>
    <groupId>io.github.biezhi</groupId>
    <artifactId>excel-plus</artifactId>
    <version>1.0.7</version>
</dependency>

snapshot version

<repositories>
    <repository>
        <id>snapshots-repo</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>io.github.biezhi</groupId>
        <artifactId>excel-plus</artifactId>
        <version>1.0.8-SNAPSHOT</version>
    </dependency>
</dependencies>

Read excel as List

public class Member {

    @ExcelColumn(title = "卡号", index = 0)
    private Long cardNo;

    @ExcelColumn(title = "卡类型", index = 1)
    private String cardType;

    @ExcelColumn(title = "领用状态", index = 2)
    private String requisitionStatus;

    @ExcelColumn(title = "状态", index = 3)
    private String status;

    @ExcelColumn(title = "余额(元)", index = 6)
    private BigDecimal amount;

    @ExcelColumn(title = "会员", index = 7)
    private String nickname;

    @ExcelColumn(title = "性别", index = 9)
    private String gender;

    @ExcelColumn(title = "手机", index = 10)
    private String mobile;

    @ExcelColumn(title = "发卡日期", index = 14, datePattern = "M/d/yyyy HH:mm")
    private Date sendCardTime;
    
    // getter setter 省略
}
List<Member> members = Reader.create(Member.class)
                 .from(new File("members.xlsx"))
                 .start(1)
                 .asList();

Write excel as file

public class Book {

    @ExcelColumn(title = "书名", index = 0)
    private String title;
    
    @ExcelColumn(title = "作者", index = 1)
    private String author;

    @ExcelColumn(title = "售价", index = 2)
    private Double price;

    @ExcelColumn(title = "出版日期", index = 3, datePattern = "yyyy年M月")
    private LocalDate publishDate;
    
    // getter setter 省略
}
Writer.create()
         .withRows(books)
         .headerTitle("书籍列表 V1")
         .to(new File("book.xlsx"));

Code See here

Browser download

Writer.create()
         .withRows(orders)
         .to(ResponseWrapper.create(HttpServletResponse, "order-list.xls"));

Examples

See here

Thanks

License

Apache2

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages