Wednesday, 15 September 2010

templates - display list with new line in a cell -



templates - display list with new line in a cell -

i utilize jxls templates generate excels files. worked pretty good.

however, know if there way display list of string in cell, new line after each element, instead of display new cell each element.

example : have list of employee

${employees.name} give me :

employee 01 employee 02 employee 03

instead of :

employee 01 employee 02 employee 03

you should create stringbuilder "\n" (break line) in string:

//in object

public string getasstring() { stringbuilder sb = new stringbuilder(); sb.append("line1").append("\n").append("line2").append("\n"); homecoming sb.tostring(); }

//in sheet

${object.asstring}

templates jxls

No comments:

Post a Comment