Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用带有模板的 JXLS 来生成 excels 文件。我工作得很好。
但是,我想知道是否有一种方法可以在单元格中显示字符串列表,每个元素后都有新行,而不是为每个元素显示一个新单元格。
示例:我有一个员工列表
${employees.name} 会给我:
代替 :
您应该在字符串中创建一个带有“\n”(断线)的 StringBuilder:
//在你的对象中
public String getAsString() { StringBuilder sb = new StringBuilder(); sb.append("line1").append("\n").append("line2").append("\n"); return sb.toString(); }
//在你的工作表中
${object.asString}