Hello, I'm getting a null pointer exception when using the XLSTransformer's markAsFixedSizeCollection method. Actually, the exception itself occurs at net.sf.jxls.util.Util.duplicateRowCollectionProperty(Util.java:238).
Here's the code: package com.nuval.sync; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import com.sun.media.sound.InvalidFormatException; import net.sf.jxls.exception.ParsePropertyException; import net.sf.jxls.transformer.XLSTransformer; public class TestJXL { public TestJXL() throws ParsePropertyException, InvalidFormatException, IOException{ ArrayList<Employee> staff = new ArrayList<Employee>(); staff.add(new Employee("Derek", 35, 3000, 0.30)); staff.add(new Employee("Elsa", 28, 1500, 0.15)); staff.add(new Employee("Oleg", 32, 2300, 0.25)); staff.add(new Employee("Neil", 34, 2500, 0.00)); staff.add(new Employee("Maria", 34, 1700, 0.15)); staff.add(new Employee("John", 35, 2800, 0.20)); staff.add(new Employee("Leonid", 29, 1700, 0.20)); HashMap<String, ArrayList<Employee>> beans = new HashMap<String, ArrayList<Employee>>(); beans.put("employee", staff); XLSTransformer transformer = new XLSTransformer(); transformer.markAsFixedSizeCollection("employee"); String templateFileName = "C:\\0temp2\\test.xls"; String destFileName = "C:\\0temp2\\dest.xls"; try { transformer.transformXLS(templateFileName, beans, destFileName); } catch (org.apache.poi.openxml4j.exceptions.InvalidFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String [] args) throws ParsePropertyException, InvalidFormatException, IOException{ new TestJXL(); } } package com.nuval.sync; import java.util.Date; public class Employee { private String name; private int age; private Double payment; private Double bonus; private Date birthDate; private Employee superior; public Employee(String name, int age, Double payment, Double bonus) { this.name = name; this.age = age; this.payment = payment; this.bonus = bonus; } public Employee(String name, int age, double payment, double bonus, Date birthDate) { this.name = name; this.age = age; this.payment = new Double(payment); this.bonus = new Double(bonus); this.birthDate = birthDate; } public Employee(String name, int age, double payment, double bonus) { this.name = name; this.age = age; this.payment = new Double(payment); this.bonus = new Double(bonus); } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public Double getPayment() { return payment; } public void setPayment(Double payment) { this.payment = payment; } public Double getBonus() { return bonus; } public void setBonus(Double bonus) { this.bonus = bonus; } public Date getBirthDate() { return birthDate; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } public Employee getSuperior() { return superior; } public void setSuperior(Employee superior) { this.superior = superior; } } The template and code are as suggested in the tutorial: http://jxls.sourceforge.net/reference/collections.html Any suggestions appreciated. ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ jXLS-user mailing list jXLS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jxls-user