Hi, I created a simple test class following your example (see attachement)
The program generates the xls document but with empty values. Can you help me spot the problem here? From my point of view everything is ok but still the values from the collection are not generated. Thanks in advance ________________________________ From: Leo <leon...@gmail.com> To: Deina <deina_s...@yahoo.com> Cc: "jxls-user@lists.sourceforge.net" <jxls-user@lists.sourceforge.net> Sent: Wednesday, October 26, 2011 1:09 PM Subject: Re: [jXLS-user] Vertical rows It is possible although the syntax may seem rather inconvenient because you will need to inject jx:forEach tag into each row. Check here http://jxls.sourceforge.net/samples/dynamiccolumnssample.html . -- Leo On Wed, Oct 26, 2011 at 1:04 PM, Deina <deina_s...@yahoo.com> wrote: Hi, > > >Is it possible to generate a xls starting from a template >in which the rows are displayed vertically and not horizontally? > > >Instead of: >Name |Age |Payment |Bonus > >Elsa |28 |100 |100 > >Ene |30 |200 |100 > > > > >it should look like this: > > >Name | Elsa | Ene > >Age | 28 | 30 > >Payment | 100 | 200 >Bonus | 100 | 100 > > > >Thanks a lot, >------------------------------------------------------------------------------ >The demand for IT networking professionals continues to grow, and the >demand for specialized networking skills is growing even more rapidly. >Take a complimentary Learning@Cisco Self-Assessment and learn >about Cisco certifications, training, and career opportunities. >http://p.sf.net/sfu/cisco-dev2dev >_______________________________________________ >jXLS-user mailing list >jXLS-user@lists.sourceforge.net >https://lists.sourceforge.net/lists/listinfo/jxls-user > >
package main.java.util; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Map; import net.sf.jxls.exception.ParsePropertyException; import net.sf.jxls.transformer.XLSTransformer; public class TestVerticalRows { public static void main(String args[]){ String templateFileName = "D:\\test\\template.xls"; String destFileName = "D:\\test\\ReportResult.xls"; Column column1 = new Column("ana", "100"); Column column2 = new Column("ana2", "200"); Column column3 = new Column("ana3", "300"); Column column4 = new Column("ana3", "300"); Collection<Column> cols = new ArrayList<Column>(); cols.add(column1); cols.add(column2); cols.add(column3); cols.add(column4); Map map = new HashMap(); map.put("cols", cols); XLSTransformer transformer = new XLSTransformer(); try { transformer.transformXLS(templateFileName, map, destFileName); } catch (ParsePropertyException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } class Column { private String name; private String rate; public Column(String name, String rate){ this.name = name; this.rate = rate; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the rate */ public String getRate() { return rate; } /** * @param rate the rate to set */ public void setRate(String rate) { this.rate = rate; } }
template.xls
Description: MS-Excel spreadsheet
ReportResult.xls
Description: MS-Excel spreadsheet
------------------------------------------------------------------------------ The demand for IT networking professionals continues to grow, and the demand for specialized networking skills is growing even more rapidly. Take a complimentary Learning@Cisco Self-Assessment and learn about Cisco certifications, training, and career opportunities. http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________ jXLS-user mailing list jXLS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jxls-user