I'm using JXLS 2.3.0 with apache poi implementation.
And I use following code to create excel :
try{
InputStream is = ObjectCollectionDemo.class.getResourceAsStream("/template.xls")
OutputStream os = new FileOutputStream("target/output.xls")
Context context = new Context();
context.putVar("employees", employees);
JxlsHelper.getInstance().processTemplate(is, os, context);
}
my generated excel file looks like next :
As above screenshot shows, the first 'Name' value only display partial.
But what I want is :
That is the content in excel cell can be wrapped and the row height can auto fit the cell content.
How can I do that? Thanks in advance.
-------------- Updated -----------------
the solution is:
- did as @Andy said
- format the corresponding cell as
wrap text
in your template file - (optional) after step 1 and 2, the 99% info of cell content can be shown, but still miss some. Then I open the template file and found it looks like next:
we can found that the }
of ${a.name}
is on the new line,
change it to:
that is make ${a.name}
is on one line, then all content can be shown.