How output single value in Excel template using jxls

Let’s look at an example of output to template a single value with information.
We can take an example from previous article and modify it a little.

Preparing template

First, we need to update the template.
Add the name of the company in the header of our report.

Added company titile to template ${companyName}  that’s how we’ll refer to our field.

Coding

Now let’s start adding this parameter to the code. To simplify the example, declare a variable and assign it a value.  In a real application, this value can be loaded for example from the database.

In the above example, we added our parameter to the template.
Let’s see what happened.Result excel file with company title

As we see, the name of the company was successfully added to the template.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.