Dear Sir,

When I tried to write Excel file using XLS template, there are some warning
messages in the console as the followings though I was able to see the
expected Excel output. What I do not understand is that username attribute
is declared in User class but the console message complains that it is not
defined. Did i miss out something please ?

[03 Apr 2011 21:31:17] WARN [org.apache.commons.jexl2.
JexlEngine] - net.sf.jxls.parser.Expression.<init>@61![0,23]:
'user.username;' undefined variable user.username

The followings are the object models and test case. Attached is the XLS
template.

public class Member {
    public String description;
}

public class User extends Member {
    public String username;
}

public class ExcelUtils {
    public static void renderExcel(String templateName, Map<String, Object>
beans) {
        InputStream is = new FileInputStream(templateName);
            org.apache.poi.ss.usermodel.Workbook workbook = new
XLSTransformer().transformXLS(is, beans);
            workbook.write(response.out);
            is.close();
    }
}

public class TestReport() {

    @Test
    public void testUserReport() {
        List<User> users = new ArrayList<User>();

        User user = new User();
        user.username = "testuser";
        user.description = "This is testing";

        users.add(user);

        Map<String, Object> beans = new HashMap<String, Object>();
        maps.add("users", users);

        ExcelUtils.renderExcel("excel.xls", beans);
    }
}

Best regards,
may

Attachment: excel.xls
Description: MS-Excel spreadsheet

------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
jXLS-user mailing list
jXLS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jxls-user

Reply via email to