NanoXLSX4j

NanoXLSX4j is a small Java library to create and read XLSX files (Microsoft Excel 2007 or newer) in an easy and native way. The library is originated form PicoXLSX4j and has basic support of reading spreadsheets

License

License

Categories

Categories

Ant Build Tools
GroupId

GroupId

ch.rabanti
ArtifactId

ArtifactId

nanoxlsx4j
Last Version

Last Version

1.2.8
Release Date

Release Date

Type

Type

jar
Description

Description

NanoXLSX4j
NanoXLSX4j is a small Java library to create and read XLSX files (Microsoft Excel 2007 or newer) in an easy and native way. The library is originated form PicoXLSX4j and has basic support of reading spreadsheets
Project URL

Project URL

https://PicoXLSX.rabanti.ch
Source Code Management

Source Code Management

https://github.com/rabanti-github/PicoXLSX4j/tree/master

Download nanoxlsx4j

How to add to project

<!-- https://jarcasting.com/artifacts/ch.rabanti/nanoxlsx4j/ -->
<dependency>
    <groupId>ch.rabanti</groupId>
    <artifactId>nanoxlsx4j</artifactId>
    <version>1.2.8</version>
</dependency>
// https://jarcasting.com/artifacts/ch.rabanti/nanoxlsx4j/
implementation 'ch.rabanti:nanoxlsx4j:1.2.8'
// https://jarcasting.com/artifacts/ch.rabanti/nanoxlsx4j/
implementation ("ch.rabanti:nanoxlsx4j:1.2.8")
'ch.rabanti:nanoxlsx4j:jar:1.2.8'
<dependency org="ch.rabanti" name="nanoxlsx4j" rev="1.2.8">
  <artifact name="nanoxlsx4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='ch.rabanti', module='nanoxlsx4j', version='1.2.8')
)
libraryDependencies += "ch.rabanti" % "nanoxlsx4j" % "1.2.8"
[ch.rabanti/nanoxlsx4j "1.2.8"]

Dependencies

test (3)

Group / Artifact Type Version
org.hamcrest : hamcrest-library jar 1.3
org.junit.jupiter : junit-jupiter-api jar RELEASE
org.junit.jupiter : junit-jupiter-params jar RELEASE

Project Modules

There are no modules declared in this project.

PicoXLSX4j PicoXLSX

Maven Central license FOSSA Status

PicoXLSX4j is a small Java library to create XLSX files (Microsoft Excel 2007 or newer) in an easy and native way. It is a direct port of PicoXLSX for C#

  • No need for an installation of Microsoft Office
  • No need for Office interop/DCOM or other bridging libraries
  • No need for 3rd party libraries
  • Pure usage of standard JRE

Please have a look at the successor library NanoXLSX4j for reader support.

Project website: https://picoxlsx.rabanti.ch

See the Change Log for recent updates.

What's new in version 2.x

  • Changed package structure to ch.rabanti.picoxlsx4j
  • Added Maven support (available in Maven Central under ch.rabanti.picoxlsx4j)
  • Complete replacement of the old style handling
  • Added appending of styles for an easier composition of complex styles
  • Added more options to assign styles to cells
  • Added Shortener (property WS) to reduce the code overhead
  • Added static methods for the most important formulas (round, floor, ceil, min, max, average, median, sum, vlookup)
  • Added Save option to save the XLSX file as stream
  • Added an option for sanitizing of worksheet names
  • Replaced specific exception classes with general exceptions (e.g. StyleException, FormatException or WorksheetException)
  • Added functions to retrieve stored data and the current cell address
  • Many internal optimizations and additional documentation

Requirements

PicoXLSX4j was initially created with Java 8 and currently build with OpenJDK 11 The only requirement for development is an up-to-date Java environment (OpenJDK 11 or higher recommended)

Installation

As JAR

Simply place the PicoXLSX4j jar file (e.g. picoxlsx4j-2.6.0.jar) into the lib folder of your project and create a library reference to it in your IDE.

As source files

Place all .java files from the PicoXLSX4j source folder into your project. The folder structure defines the packages. Please use refactoring if you want to relocate the files.

Maven

Add the following information to your POM file within the <dependencies> tag:

<dependency>
    <groupId>ch.rabanti</groupId>
    <artifactId>picoxlsx4j</artifactId>
    <version>2.6.0</version>
</dependency>

Important: The version number may change. Please see the version number of Maven Central at the top of the README (maven-central badge) or check the Change Log for the most recent version. The keywords LATEST and RELEASE are only valid in Maven 2, not 3 and newer.

Usage

Quick Start (shortened syntax)

 Workbook workbook = new Workbook("myWorkbook.xlsx", "Sheet1");         // Create new workbook with a worksheet called Sheet1
 workbook.WS.value("Some Data");                                        // Add cell A1
 workbook.WS.formula("=A1");                                            // Add formula to cell B1
 workbook.WS.down();                                                    // Go to row 2
 workbook.WS.value(new Date(), BasicStyles.Bold());                     // Add formatted value to cell A2
 try{
   workbook.save();                                                     // Save the workbook as myWorkbook.xlsx
 } catch (Exception ex) {}

Quick Start (regular syntax)

 Workbook workbook = new Workbook("myWorkbook.xlsx", "Sheet1");       // Create new workbook with a worksheet called Sheet1
 workbook.getCurrentWorksheet().addNextCell("Some Data");             // Add cell A1
 workbook.getCurrentWorksheet().addNextCell(42);                      // Add cell B1
 workbook.getCurrentWorksheet().goToNextRow();                        // Go to row 2
 workbook.getCurrentWorksheet().addNextCell(new Date());              // Add cell A2
 try {
   workbook.Save();                                                   // Save the workbook as myWorkbook.xlsx
 } catch (Exception ex) {}

Further References

See the full **API-Documentation at: https://rabanti-github.github.io/PicoXLSX4j/. The Demo class contains 13 simple use cases. You can also look at the full API documentation or the Javadoc annotations in the particular .java files.

License

FOSSA Status

Versions

Version
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.0
1.0.1
1.0.0