How to generate excel documents/reports using templates in Java?

<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls</artifactId>
<version>2.10.0</version>
</dependency>
  1. Apache POI — To use Apache POI API based transformer implementation
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls-poi</artifactId>
<version>2.10.0</version>
</dependency>
<dependency>
<groupId>org.jxls</groupId>
<artifactId>jxls-jexcel</artifactId>
<version>${jxlsJexcelVersion}</version>
</dependency>
List<Employee> employeeList = employeeService.getEmployees();
try (InputStream is = getClass().getClassLoader().getResource(“excelTemplates/Employee.xlsx”).openStream()) {
try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
Context context = new Context();
String fileName = “Employee”;
context.putVar(“employees”, employeeList);
JxlsHelper.getInstance().processTemplate(is, os, context);
}
}
(i)
(ii)
(iii)

--

--

--

Hello World, I am an aspiring full-stack web developer and a tech enthusiast.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Xamarin Mobile Development: add an image

Breaking into the industry: My Journey to becoming a Software Engineer — Pomodoro Technique

This Technology Will Replace Smartphones

Magento 2 Edition Differences: Open Source VS Commerce. Part 2

Exploring Ruby as a New Programmer

ML-Running diagnostics

Now Setup And Run Your Klever Node

Cheat sheet for implementing 7 methods for selecting the optimal number of clusters in Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alekya Ragipally

Alekya Ragipally

Hello World, I am an aspiring full-stack web developer and a tech enthusiast.

More from Medium

Why spring boot is the famous framework for developing REST APIs in Java

How to create your own Dependency injection framework in Java

Logging in Java

The Spring Revolutions 3 — Configuration