Code Monkey home page Code Monkey logo

excel-plus's Introduction

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.2</version>
</dependency>

snapshot version

<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>

<dependencies>
    <dependency>
        <groupId>io.github.biezhi</groupId>
        <artifactId>excel-plus</artifactId>
        <version>1.0.3-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

excel-plus's People

Contributors

hellokaton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.