“This is the 17th day of my participation in the First Challenge 2022.

👨🎓 Author: Bug Bacteria

✏️ blog: CSDN, Nuggets, etc

💌 public account: Magic House of the Circle of the Apes

🚫 special statement: original is not easy, reprint please attach the original source link and this article statement, thank you for your cooperation.

🙏 Copyright notice: part of the text or pictures in the article may come from the Internet or Baidu Encyclopedia, if there is infringement, please contact bug bacteria processing.

Hi, family. I’m the bug. Here I go again. Today we are going to talk about something, OK, and we will continue the Series of articles on SpringBoot. Hope to help more beginners quickly start!

In the process of reviewing articles, if you think the articles are helpful to you at all, please don’t be too mean with your likes and bravely light up the articles 👍. Your likes (collect ⭐️+ pay attention to 👨 port + message board) are the best encouragement and support for bugs on my creation path. Time does not abandon 🏃🏻♀️, creation stopped 💕, refueling 🏻

An overview,

Today I am going to introduce a very useful POI tool class, I will not reveal what it is for the moment, we all know, usually in the development of web system or OA system, the basic project will involve some document import and export, right, for example, in the page, what template download, one-click batch import, XXX table data local Excel batch download, etc. These requirements sound so familiar that they can be implemented with your eyes closed. After all, I’ve written about them a lot.

So this period I will choose to tell everybody, I’m in the normal development of so many similar needs, is what makes me feel good and will continue to be used the small tool, although there are thousands of kinds of import and export functions method, but how to write the most convenient, convenience, and expand the width, then I think it is good for me I development, provide the development efficiency, Then I would be better than using it. And I also want to share with you, so that you can also in daily development can not repeat the wheel does not repeat, improve work efficiency, leave work early! Save your hair.

. .

What I would recommend is Easypoi. Its emergence greatly simplifies the development of the document import and export implementation, unlike POI to write a large section of tool class to read and write file content, Easypoi is really unique child, can make a person who has never seen contact with POI, can be very easy to achieve excel import and export,

Two, Easypoi introduction

1. What is EasyPOI?

Easypoi features as easy as its name suggests! Also a POI utility class, but not as complex to use as POI.

2. Why use EasyPOI?

Easypoi’s main function is easy and easy to use. It makes it easy for a developer who has never seen or touched a POI to write Excel imports and exports, rather than having to read a lot of apis to do so.

It through simple annotations and template language (familiar expression syntax), complete the previous complex writing, EasyPoi quickly achieve Excel import and export functions, and modify the export format is simple and crude, fast and effective.

3. What functions does EasyPOI provide?

  • Import and export based on annotations. Modify the annotations to modify Excel.
  • Support common style customization.
  • Table header fields that can be flexibly defined based on map.
  • Supports one-to-many export and import.
  • Support template export, some common tags, custom tags.
  • Support HTML/Excel conversion, if the template does not meet the user’s abnormal needs, please use this feature
  • Support word export, support pictures,Excel

3. Project dependency configuration

In our pom.xml configuration file, add the Easypoi dependency as follows:

<! - easypoi dependence, <dependency> <groupId>cn. Afterturn </groupId> <artifactId> easyPoi-base </artifactId> <version>3.2.0</version> </dependency> <dependency> <groupId>cn. Afterturn </groupId> <artifactId> easyPOi -web</artifactId> < version > 3.2.0 < / version > < / dependency > < the dependency > < groupId > cn. Afterturn < / groupId > < < artifactId > easypoi - an annotation/artifactId > < version > 3.2.0 < / version > < / dependency >Copy the code

Popular science:

What are the functions of the three packages imported above?

  • easypoi-annotationBasic annotation package, function and entity object, after splitting convenient maven multi-project dependency management
  • easypoi-baseImport and export toolkit, you can complete Excel import and export,Word export and other functions.
  • easypoi-webThe couplingspring-mvcBased on theAbstractViewGreat simplificationspring-mvcUnder the export function.

But with the more and more popular springboot, the inevitable easyPOI also launched easyPOI-Spring-boot-starter for us, convenient for us to use.

So we can eliminate the need to introduce so many related dependencies, save the POM files look too long to find.

Here is the starter for easyPOi, which you can copy and paste into your local POP.xml.

<! <dependency> <groupId>cn. Afterturn </groupId> < artifactId > easypoi - spring - the boot - starter < / artifactId > < version > 4.2.0 < / version > < / dependency >Copy the code

Four, Easypoi commonly used notes introduction

Next, I will explain to you, after the integration of easyPOI commonly used to some annotations, but also for the convenience of everyone more quickly start easyPOI. Good cut? Hope you practice carefully, in the future actual development can also save you some time, basically you are familiar with these annotations, know that annotation is what to use, this line.

  • @Excel

Filed represents a description of the Excel column.

This is a mandatory, if simple, annotation that covers common Excel requirements.

Such as:

String name(); // Column name. Name_id int type() default 1; Double width() default 10.0d; String orderNum() default "0"; // Column sort, supporting name_idCopy the code
  • @ExcelCollection

Represents a set, mainly for one-to-many export, for example, a teacher corresponds to multiple subjects, subjects can be represented by the set.

  • @ExcelEntity

Represents a further export entity, but it does not have much practical meaning, but it tells the system that this object also has exported fields.

  • @ExcelIgnore

As the name indicates that this field is ignored skip the derivation.

  • @ExcelTarget

This is applied to the outermost object and describes the id of the object so that an object can be treated differently for different exports.

  • .

Easypoi notes for more use and details, we can move to easyPOI’s official website, I will not list here. Easypoi official website address.

. .

Well, that’s all for this episode and I’ll see you next time.

Five, the past popular recommendation

  • Springboot series (15) : AOP implements custom annotations for business logging! Have you ever played?

  • Springboot series (14) : Redis Zero-based teaching, you deserve it!

  • Springboot Series (thirteen) : How to project integrated Swagger online interface documentation, will you?

  • Springboot series (12) : How to code to send email reminders, have you written?

  • . .

If you want to learn more, you can pay attention to the bug bug column “SpringBoot Zero-based Introduction”, from scratch, from zero to one! Hope I can help you.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

☘️ Be who you want to be, there is no time limit, you can start whenever you want,

🍀 You can change from now on, you can also stay the same, this thing, there are no rules to speak of, you can live the most wonderful yourself.

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

💌 If this article is helpful to you, please leave a like! (# ^. ^ #);

💝 if you like the article shared by bug fungus, please give bug fungus a point of concern! The danjun ‘ᴗ, you guys will have a cameo appearance with you.

💗 if you have any questions about the article, please also leave a message at the end of the article or add a group [QQ communication group :708072830];

💞 In view of the limited personal experience, all views and technical research points, if you have any objection, please directly reply to participate in the discussion (do not post offensive comments, thank you);

💕 copyright notice: original is not easy, reprint please attach the original source link and this article statement, all rights reserved, piracy will investigate!! thank you