-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Welcome to the PicoXLSX4j wiki!
PicoXLSX is a port of PicoXLSX for C#. It is a small Java library to create Microsoft Excel files (XLSX for Office 2007 or newer) in an easy and native way. This means:
- 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
See the Change Log for recent updates.
PicoXLSX4j was created with Java 8 and is fully compatible with Java 7
The only requirements for development are a current JDK to develop and JRE to run.
Simply place the PicoXLSX4j.jar into the lib folder of your project and create a library reference to it in your IDE.
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.
Add the following information to your POM file within the <dependencies>
tag:
<dependency>
<groupId>ch.rabanti</groupId>
<artifactId>picoxlsx4j</artifactId>
<version>VERSION NUMBER</version>
</dependency>
Important: The VERSION NUMBER must be defined (e.g. 2.3.1).
Please see the version number of Maven Central
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.
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) {}
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) {}
See the full API-Documentation at: https://rabanti-github.github.io/PicoXLSX4j/.
The Demo class contains several simple use cases. You can find also the full documentation in the Javadoc-Folder or as Javadoc annotations in the .java files.