Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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
Appearance settings

Object-oriented java Excel library

License

NotificationsYou must be signed in to change notification settings

Vatavuk/excel-io

Repository files navigation

Java excel library (Apache POI inside)

EO principles respected hereDevOps By Rultor.com

Build StatusJavadocsMaven CentralLicense

Test CoverageSonarQube

This is an object-oriented java library for reading and writing Microsoft Office Excel spreadsheets.It is a wrapper around Apache POI that provides elegant and user friendly interface for creating Excel documents.

How to use.Latest versionhere

<dependency>    <groupId>hr.com.vgv</groupId>    <artifactId>excel-io</artifactId></dependency>

Java version required: 1.8+.

Create spreadsheet

newXsWorkbook(newXsSheet(newXsRow()            .with(newTextCells("name","email","salary","bonus","total"))            .with(newXsStyle(newForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()),newFillPattern(FillPatternType.SOLID_FOREGROUND)                )            ),newXsRow()            .with(newTextCells("Steve Hook","steve.hook@gmail.com"))            .with(newNumberCells(160000.0,35337.6))            .with(newFormulaCell("SUM(C3:D3)")                .with(newXsStyle(newForegroundColor(IndexedColors.RED.getIndex()),newFillPattern(FillPatternType.SOLID_FOREGROUND)                    )                )            )            .with(newXsProps<>(newHeight((short)500)))    )).saveTo("Test.xlsx");

This is how the result looks like:

Read and modify spreadsheet

Read from "Test.xlsx" file and modify cell int the second row/first column.

newXsWorkbook("Test.xlsx")    .with(newXsSheet.ReadFrom(0)        .with(newXsRow(2,newTextCell(1,"UPDATED")            )        )    ).saveTo("Updated.xlsx");

Custom styles

You can create custom cells/rows/sheets:

newXsWorkbook(newXsSheet(newMyCustomRow("Boris","Miksic","ID:2450"),newMyCustomRow("Mirko","Mirkic","ID:1690")    )).saveTo("Test.xlsx");

Just extend appropriate template class and pass custom row/cell object to its constructor:

privatestaticclassMyCustomRowextendsRowTemplate {publicMyCustomRow(finalStringname,finalStringsurname,finalStringid) {super(newXsRow()                .with(newTextCells(name,surname))                .with(newMyGreyCell(newTextCell(id)))        );    }}privatestaticclassMyGreyCellextendsCellTemplate {publicMyGreyCell(finalECellcell) {super(cell.with(newXsStyle(newForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()),newFillPattern(FillPatternType.SOLID_FOREGROUND)            )        ));    }}

The result:

Contribution

You can contribute by forking the repo and sending a pull request.Make sure your branch builds without any warnings/issues:

mvn clean install -Pqulice

About

Object-oriented java Excel library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp