https://github.com/hs-web/reactor-excel
https://github.com/hs-web/reactor-excel
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hs-web/reactor-excel
- Owner: hs-web
- Created: 2020-03-17T10:43:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-08-19T06:23:57.000Z (over 1 year ago)
- Last Synced: 2024-11-14T17:47:54.649Z (about 1 year ago)
- Language: Java
- Size: 174 KB
- Stars: 8
- Watchers: 4
- Forks: 22
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 基于Reactor的excel,csv导入导出
[](https://travis-ci.com/hs-web/reactor-excel)
[](https://codecov.io/gh/hs-web/reactor-excel)
```java
ReactorExcel
.writeFor("csv")
.justWrite()
.sheet(spec->{
spec.header("id","ID")
.header("name","name")
.rows(datas)
})
.write(new FileOutputStream("./target/test.csv"))
.as(StepVerifier::create)
.expectComplete()
.verify();
```
```java
ReactorExcel
.readToMap(inputStream,"csv")
.as(StepVerifier::create)
.subscribe(map->System.out.println(map));
```
多sheet写出
```java
ReactorExcel
.xlsxWriter()
.sheet(sheet->{
sheet.name("S1")
.header("id","ID")
.header("name","姓名")
.rows(dataFlux);
})
.sheet(sheet->{
sheet.cell(0,0,"Name")
.cell(1,0,"Age")
.cell(0,1,"Test")
.cell(1,1,1)
.option(sheet_->{//自定义sheet操作
sheet_.addMergedRegion(CellRangeAddress.valueOf("A3:B3"));
sheet_.addMergedRegion(CellRangeAddress.valueOf("C1:C3"));
});
})
.write(new FileOutputStream("./target/test.xlsx"))
.subscribe();
```