# easy-excel
**Repository Path**: fxfly/easy-excel
## Basic Information
- **Project Name**: easy-excel
- **Description**: 开发目的,省去复杂的excel代码
使用xml配置的形式完成导入导出
- **Primary Language**: Java
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 86
- **Created**: 2017-06-16
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
**#easy-excel**
**使用介绍**
http://my.oschina.net/lis1314/blog/693989
**
关于与Spring集成只需要加入下面配置**
```
```
**一、jar包依赖**

**二、如何使用?,参考**
org.easy.excel.test.ExportTest
org.easy.excel.test.ImportTest
支持,复杂对象导航,支持自定义(单元格宽度)
标题样式(背景色,对齐方式,字体颜色)
导出测试使用时,运行org.easy.excel.test.ExportTest类的测试方法,观察具体生成的excel文件
导入测试使用时,运行org.easy.excel.test.ImportTest,观察org.easy.excel.vo.ExcelImportResult
下面展示配置文件
上述配置,目前以包含所有支持的可配置属性。
关于excel配置属性说明:参看org.easy.excel.vo.ExcelDefinition
关于field配置属性说明参看:org.easy.excel.vo.FieldValue
关于使用:这里附上部分代码
(开发者只需要关注一个类即可org.easy.excel.ExcelContext),这个类暴露了对外的导入导出所有功能,通常在实际项目里,把它配置到spring容器中初始化一个就可以了
1、导入
```
public void testImport()throws Exception{
InputStream fis = new FileInputStream(path);
ExcelImportResult result = context.readExcel(excelId, fis);
System.out.println(result.getHeader());
List stus = result.getListBean();
for(StudentModel stu:stus){
System.out.println(stu);
BookModel book = stu.getBook();
System.out.println(book);
if(book!=null){
System.out.println(book.getAuthor());
}
}
}
```
2、导出
```
public void testExportSimple()throws Exception{
OutputStream ops = new FileOutputStream(path);
Workbook workbook = context.createExcel(excelId,getStudents());
workbook.write(ops);
ops.close();
workbook.close();
}
```
**技术交流群**
**489137933**