Skip to content

hs-web/reactor-excel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

基于Reactor的excel,csv导入导出

Build Status codecov

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();
ReactorExcel
        .readToMap(inputStream,"csv")
        .as(StepVerifier::create)
        .subscribe(map->System.out.println(map));

多sheet写出

 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();