Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A fast import and export tool for Excel.

License

NotificationsYou must be signed in to change notification settings

feng-haitao/auto-excel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

中文 | English |Documentation

Why AutoExcel?

Excel import and export is very common in software development, as long as you are a programmer, you have met. I believe that many people will choose to use Apache POI to complete this work like me. While feeling the power of POI, my team also encountered the following problems:

  1. Directly use POI to operate Excel will generate a lot of hard code, you will hardly write row index and column index in the code.
  2. A large number of non-reusable format control codes, such as background color, alignment, cell style, etc.
  3. The implementation consultant clearly provided a ready-made template, but had to develop the code to implement it again, resulting in low development efficiency.
  4. Development resources have to be used when the template is adjusted.
  5. Simple export also requires specific code.

AutoExcel solves the above problems. It is very simple and only requires a small amount of code to complete complex import and export. When using it, programmers have no sense of import and export, that is, there is no need to directly manipulate POI. At the same time, the implementation consultant provides Excel is the import and export template, unless new data sources or fields are added, the template update does not need to use development resources.

AutoExcel does not over-encapsulate the POI, but makes full use of Excel's own feature-the name manager, through some tricks, the cell and the data source are mapped, thereby decoupling the programmer and the POI, and avoid hard code, so that import and export work becomes enjoyable and no longer boring.

Features

  • Export with template
    • Support multiple sheets
    • Support basic object and table data
    • A single sheet supports multiple data sources of variable length
    • Support horizontal filling of data
    • Automatically apply cell style
    • Auto fill in line number
    • Auto fill formula
    • Automatic summary
  • Export directly
    • Support multiple sheets
    • Export with basic style
    • Automatically adjust column width
  • Import
    • Support multiple sheets
    • Automatic data type conversion
  • Support millions of data import and export in seconds

Function preview

Before exportAfter export
imageimage
imageimage
imageimage
imageimage

To achieve all of the above exports, you only need to write the following small amount of code (you need additional code to prepare the data source, for example, from the database. In the following example, useDataGenerator to generate demo data)

// Set export parameters, such as data source name, data source, etc.List<TemplateExportPara>paras =newArrayList<>();paras.add(newTemplateExportPara("BusinessUnit",DataGenerator.genBusinessUnit()));paras.add(newTemplateExportPara("Contract",DataGenerator.genContracts()));paras.add(newTemplateExportPara("Project",DataGenerator.genProjects(1)));List<Product>products =DataGenerator.genProducts(1);TemplateExportParapara3 =newTemplateExportPara("Product",products);// When a single sheet has multiple data sources, the data source above should be set to insertedpara3.setInserted(true);paras.add(para3);TemplateExportParapara5 =newTemplateExportPara("Product2",products);// Horizontal fillpara5.setDataDirection(DataDirection.Right);paras.add(para5);// (Optional operation) Remove unnecessary sheetsExcelSettingexcelSetting =newExcelSetting();excelSetting.setRemovedSheets(Arrays.asList("will be removed"));AutoExcel.save(this.getClass().getResource("/template/Export.xlsx").getPath(),this.getClass().getResource("/").getPath() +"AutoExcel.xlsx",paras,excelSetting);

Million data test

Unit: ms

10W rows and 10 columns of data100W rows and 10 columns of data
Export with template6,25823,540
Export directly5,71124,952
Import4,46621,595
Import + Type conversion4,82326,279

Maven

<dependency>  <groupId>net.fenghaitao</groupId>  <artifactId>auto-excel</artifactId>  <version>2.0.0</version></dependency>

For more functions, please go toDocumentation.


[8]ページ先頭

©2009-2025 Movatter.jp